You are here, so you know Amazon Linux 2 and are interested in.
But you are not professional of Amazon Linux 2, are you?
With this artile you will be able to operate Amazon Linux 2, let’s go!
- If you have experience using Linux, you can use it with ease. - Package manager is yum. It is easy to add/remove apps. - Amazon Linux is light-weight design. Perhaps it doesn't have package which you want to use. In this case you can add by yum. If you don't want to do it, Ubuntu is best solution. - Memory consumption is about 70MB, very small! - kernel version is 4.x, a little bit old. If you want 5.x features, you'd better use Ubuntu.
I usually use Ubuntu/Arch and I felt Amazon Linux 2 is like non GUI OS based on CentOS.
Since the package manager is yum, the major package can be easily installed by this.
– sudo yum install <package name>
There is also a benefit that there are many information of yum on the internet.
You can easily find solution when you face trouble.
Furthermore, it is also a big advantage that you can utilize know-how if you are used to operate CentOS/Fedora.
You can find solution when you are in trouble,
– Search with “Amazon Linux 2 + (keywords)”.
– Search with “CentOS + (keywords)” in case you couldn’t find.
Or “Fedora + (keywords)”
There is also good point that foot print of RAM is small from not only billing but also security.
One thing you need to be aware of is that kernel’s version is a little old with 4.x.
If you want to use the latest feature which is realized in 5.x, you will choose a different distribution such as Ubuntu.
On the other hand, old also means stable.
If you prefer stability rathar than functionality/novelity, Amazon Linux 2 is the best.
What is Amazon Linux 2?
It is a Linux distribution optimized for AWS provided by Amazon.
According to this page, the number of instances exceeds 500,000 and this is the top.
On the AWS description page,
Amazon Linux 2 is the next generation of Amazon Linux, a Linux server operating system from Amazon Web Services (AWS).https://aws.amazon.com/amazon-linux-2/
As you can see, Amazon Linux 2 is a Linux distribution that is optimized to be used on AWS.
Creating Amazon Linux 2 instance
This blog is on lightsail, and it is the first time for EC2 for me.
Go to EC2 page and select Launch Instance.
Select Amazon Linux 2.
It should probably have already been selected.
Select instance type which specifies CPU and memory.
This time I chose t2.micro, which has 1 year free of use.
It is a confirmation. If you Launch , instance will be created and launched.
You will be asked which key pair to use.
Key pair is used only when you intend to use third party SSH software such putty/teraterm.
It started safely. How easy!
Try Amazon Linux 2
I operate as I want to.
First of all, let’s log in with SSH.
This time, I use browser.
If you want to use third party software such putty/teraterm or Linux console SSH command, please set the public key authentication method and use pem file which we made earlier.
Check the instance and select Connect.
We made it!
Version of kernel is 4.14 and a little old.
It is 5.x in Ubuntu.
“used” is 75MB.
I feel like it’s pretty little.
Ubuntu Server 20.04 is shown as below.
149MB, about twice as much as Amazon Linux 2.
Measured by du command as 1.4GB.
In Ubuntu I got 2.2GB.
Amazon Linux 2 is much smaller, isn’t it?
Ubuntu is already installed many useful packages.
I tried it because it’s easy to bench.
In conclusion, there was no much difference between Amazon Linux 2 and Ubuntu.
Building nextcloud on Amazon Linux 2
Let’s try to establish nextcloud on Amazon Linux 2 to get used to.
The setup procedure is written in below article.
Install required packages.
If you install PHP with yum, the old version of PHP 5.x is installed and this does not satisfy prerequisit of nextcloud. So let’s install PHP7.3 instead of 5.x.
sudo yum install httpd sudo amazon-linux-extras install php7.3 sudo yum install php-zip php-xml php-mbstring php-gd php-curl
“amazon-linux-extras” is a command that allows you to install additional packages.
As of February 01, 2021, the packages included were:
0 ansible2 available \ [ =2.4.2 =2.4.6 =2.8 =stable ] 2 httpd_modules available [ =1.0 =stable ] 3 memcached1.5 available \ [ =1.5.1 =1.5.16 =1.5.17 ] 5 postgresql9.6 available \ [ =9.6.6 =9.6.8 =stable ] 6 postgresql10 available [ =10 =stable ] 8 redis4.0 available \ [ =4.0.5 =4.0.10 =stable ] 9 R3.4 available [ =3.4.3 =stable ] 10 rust1 available \ [ =1.22.1 =1.26.0 =1.26.1 =1.27.2 =1.31.0 =1.38.0 =stable ] 11 vim available [ =8.0 =stable ] _ php7.2 available \ [ =7.2.0 =7.2.4 =7.2.5 =7.2.8 =7.2.11 =7.2.13 =7.2.14 =7.2.16 =7.2.17 =7.2.19 =7.2.21 =7.2.22 =7.2.23 =7.2.24 =7.2.26 =stable ] _ lamp-mariadb10.2-php7.2 available \ [ =10.2.10_7.2.0 =10.2.10_7.2.4 =10.2.10_7.2.5 =10.2.10_7.2.8 =10.2.10_7.2.11 =10.2.10_7.2.13 =10.2.10_7.2.14 =10.2.10_7.2.16 =10.2.10_7.2.17 =10.2.10_7.2.19 =10.2.10_7.2.22 =10.2.10_7.2.23 =10.2.10_7.2.24 =stable ] 18 libreoffice available \ [ =188.8.131.52_15 =184.108.40.206 =stable ] 19 gimp available [ =2.8.22 ] 20 docker=latest enabled \ [ =17.12.1 =18.03.1 =18.06.1 =18.09.9 =stable ] 21 mate-desktop1.x available \ [ =1.19.0 =1.20.0 =stable ] 22 GraphicsMagick1.3 available \ [ =1.3.29 =1.3.32 =1.3.34 =stable ] 23 tomcat8.5 available \ [ =8.5.31 =8.5.32 =8.5.38 =8.5.40 =8.5.42 =8.5.50 =stable ] 24 epel available [ =7.11 =stable ] 25 testing available [ =1.0 =stable ] 26 ecs available [ =stable ] 27 corretto8 available \ [ =1.8.0_192 =1.8.0_202 =1.8.0_212 =1.8.0_222 =1.8.0_232 =1.8.0_242 =stable ] 28 firecracker available [ =0.11 =stable ] 29 golang1.11 available \ [ =1.11.3 =1.11.11 =1.11.13 =stable ] 30 squid4 available [ =4 =stable ] 31 php7.3=latest enabled \ [ =7.3.2 =7.3.3 =7.3.4 =7.3.6 =7.3.8 =7.3.9 =7.3.10 =7.3.11 =7.3.13 =stable ] 32 lustre2.10 available \ [ =2.10.5 =2.10.8 =stable ] 33 java-openjdk11 available [ =11 =stable ] 34 lynis available [ =stable ] 35 kernel-ng available [ =stable ] 36 BCC available [ =0.x =stable ] 37 mono available [ =5.x =stable ] 38 nginx1 available [ =stable ] 39 ruby2.6 available [ =2.6 =stable ] 40 mock available [ =stable ] 41 postgresql11 available [ =11 =stable ] _ php7.4 available [ =stable ] 43 livepatch available [ =stable ] 44 python3.8 available [ =stable ] 45 haproxy2 available [ =stable ] 46 collectd available [ =stable ] 47 aws-nitro-enclaves-cli available [ =stable ] 48 R4 available [ =stable ] 49 kernel-5.4 available [ =stable ] 50 selinux-ng available [ =stable ]
Download the latest version of nextcloud and deploy it to /var/www/html/.
wget https://download.nextcloud.com/server/releases/latest.zip cd /var/www/html/ sudo unzip /home/ec2-user/latest.zip sudo chown -R apache:apache nextcloud
Now you’re ready to launch nextcloud.
Initially EC2 closes all ports other than SSH ports which is 22.
Do open HTTP/HTTPS ports.
Select the instance on the instance list page.
Select corresponding Security groups in Security tab.
Go to Edit inbound rules in Inbound rules tab.
Add rules to allow HTTP and HTTPS to inbound rules.
Click Add rule.
Specify HTTP and Anywhere.
Do same as HTTPS.
I think that it is as follows.
Now you should be able to access nextcloud.
– http://<IP address of instance>/nextcloud/
I was able to make a nextcloud server in 10 minutes…
How easy it is…
How was it?
We hope this article can help you to know AWS/Amazon Linux!