Purpose of Amazon Linux 2
Purpose of Amazon Linux 2
Amazon Linux 2 is the next generation of Amazon Linux, a Linux server operating system from
Amazon Web Services (AWS). It provides a secure, stable, and high performance execution
environment to develop and run cloud and enterprise applications. With Amazon Linux 2, you
get an application environment that offers long term support with access to the latest innovations
in the Linux ecosystem. Amazon Linux 2 is provided at no additional charge.
Amazon Linux 2 is available as an Amazon Machine Image (AMI) for use on Amazon Elastic
Compute Cloud (Amazon EC2). It is also available as a Docker container image and as a virtual
machine image for use on Kernel-based Virtual Machine (KVM), Oracle VM VirtualBox,
Microsoft Hyper-V, and VMware ESXi. The virtual machine images can be used for on-
premises development and testing. Amazon Linux 2 supports the latest Amazon EC2 features
and includes packages that enable easy integration with AWS. AWS provides ongoing security
and maintenance updates for Amazon Linux 2.
Amazon Linux 2 includes support for the latest Amazon EC2 instance capabilities and is tuned
for enhanced performance. It includes packages that help ease integration with other AWS
Services. Amazon Linux 2 includes packages and configurations that provide tight integration
with many Amazon Web Services (AWS) services. Amazon Linux 2 comes with many AWS
tools (e.g. AWS CLI) and cloud-init. These tools are designed to simplify the scripting of
common administration tasks from within an instance and enable remote configuration of
instances. Amazon Linux is provided by Amazon Web Services (AWS). It is designed to provide
a stable, secure, and high-performance execution environment for applications running on
Amazon EC2. It also includes packages that enable easy integration with AWS, including launch
configuration tools and many popular AWS libraries and tools. AWS provides ongoing security
and maintenance updates for all instances running Amazon Linux. Many applications developed
on CentOS (and similar distributions) run on Amazon Linux.
Amazon Linux 2 is available as a virtual machine image for on-premises use, enabling you to
easily develop, test, and certify applications from a local development environment. Amazon
Linux 2 includes the widely adopted systemd init system which is used to bootstrap the user
space as well as manage system processes.
Target market
Amazon is the largest player in the cloud market, and its Amazon Web Services (AWS) cloud
computing platform has maintained a very strong growth rate since its launch in 2006.
To help its customers take full advantage of its cloud offering, the company created its own
Linux server operating system, called Amazon Linux. Based on Red Hat Enterprise Linux
(RHEL), Amazon Linux stands out thanks to its tight integration with many Amazon Web
Services (AWS) services, long-term support, and a compiler, build toolchain, and LTS Kernel
tuned for better performance on Amazon EC2.
1
In December 2017, Amazon announced the second version of its Linux operating system:
Amazon Linux 2. Just like its predecessor, Amazon Linux 2 will be supported for 5 years with
security and maintenance updates, until June 30, 2023.
How to Install
First create an EC2 instance, so that we continue this article.
Then, please run the below commands to install Nginx. I will give an explanation of each line
one by one below.
The first line in this code block is for shebang ( #!/bin/bash). In computing, a shebang is the
character sequence consisting of the character’s number sign and an exclamation mark at the
beginning of a script. It is also called sha-bang, hashbang, pound-bang, or hash-pling. This
indicates an interpreter for execution under UNIX / Linux operating systems. Most Linux shell
and Perl / python script starts with the following line.
The next line is sudo yum update -y. Using this command we are updating YUM. YUM
(Yellowdog Updater Modified) is an open-source command-line as well as graphical based
package management tool for RPM (RedHat Package Manager) based Linux systems. It allows
users and system administrators to easily install, update, remove, or search software packages on
a system. So sudo yum update -y basically updates all packages to its the latest version from a
repository list which is managed by Amazon for Amazon Linux 1. This is always a good practice
to run “yum update” first before you install any software.
#!/bin/bash
sudo yum update -y
Next, we are going to install Nginx server with php7.3 and other PHP extensions which are used
very frequently used like FPM, MySQLND, MBSTRING, INTL, GD, MCRYPT and ZIP.
After installing Nginx, we need to start the server using the following commands.
Then we need set auto start Nginx when server reboots. Otherwise, if you reboot the instance,
you need to manually start your Nginx server. This is quite important for the production
environment, and I suggest always setup Nginx start at boot time.
After that, we will add a group and assign user apache, ec2-user to that group.
2
sudo usermod -a -G www ec2-user
sudo usermod -a -G www apache
Once you created the group, then set proper file permissions.
At last, restart the Nginx server to see the changes that we have made to take effect.
aws-amitools-ec2
aws-apitools-as
aws-apitools-cfn
aws-apitools-elb
aws-apitools-mon
aws-cfn-bootstrap
aws-cli
Amazon Linux 2 and the minimal versions of Amazon Linux (amzn-ami-minimal-* and amzn2-
ami-minimal-*) do not always contain all of these packages; however, you can install them
from the default repositories using the following command:
For instances launched using IAM roles, a simple script has been included to prepare
AWS_CREDENTIAL_FILE, JAVA_HOME, AWS_PATH, PATH, and product-specific environment
variables after a credential file has been installed to simplify the configuration of these tools.
Also, to allow the installation of multiple versions of the API and AMI tools, we have placed
symbolic links to the desired versions of these tools in /opt/aws, as described here:
/opt/aws/bin
3
/opt/aws/{apitools|amitools}
Products are installed in directories of the form name-version and a symbolic link name
that is attached to the most recently installed version.
/opt/aws/{apitools|amitools}/name/environment.sh
medium
low
security
Apply outstanding critical or important updates that Amazon marks as security updates.
bugfix
Apply updates that Amazon marks as bug fixes. Bug fixes are a larger set of updates,
which include security updates and fixes for various other minor bugs.
Gzip
MIME multipart
Using a MIME multipart file, you can specify more than one type of data. For
example, you could specify both a user-data script and a cloud-config type. Each
part of the multipart file can be handled by cloud-init if it is one of the supported
formats.
Base64 decoding
User-Data script
4
Begins with #! or Content-Type: text/x-shellscript.
Include file
This content is an include file. The file contains a list of URLs, one per line. Each
of the URLs is read, and their content passed through this same set of rules. The
content read from the URL can be gzipped, MIME-multi-part, or plaintext.
Upstart job
This content is stored in a file in /etc/init, and upstart consumes the content as per
other upstart jobs.
Cloud Boothook
This content is boothook data. It is stored in a file under /var/lib/cloud and then
runs immediately.
This is the earliest "hook" available. There is no mechanism provided for running
it only one time. The boothook must take care of this itself. It is provided with the
instance ID in the environment variable INSTANCE_ID. Use this variable to
provide a once-per-instance set of boothook data.
5
2. Use the adduser command to add a new user account to an EC2 instance (replace new_user
with the new account name). The following example creates an associated group, home
directory, and an entry in the /etc/passwd file of the instance:
Note: If you add the new_user to an Ubuntu instance, include the --disabled-password option
to avoid adding a password to the new account:
3. Change the security context to the new_user account so that folders and files you create
have the correct permissions:
$ sudo su - new_user
Note: When you run the sudo su - new_user command, the name at the top of the command
shell prompt changes to reflect the new user account context of your shell session.
$ mkdir .ssh
5. Use the chmod command to change the .ssh directory's permissions to 700. Changing the
permissions restricts access so that only the new_user can read, write, or open the .ssh directory.
6. Use the touch command to create the authorized_keys file in the .ssh directory:
$ touch .ssh/authorized_keys
7. Use the chmod command to change the .ssh/authorized_keys file permissions to 600.
Changing the file permissions restricts read or write access to the new_user.
Use the following procedure to create a user group for your Systems Manager users. You can
repeat this procedure to create additional user groups with different sets of permissions.
1. In the navigation pane of the IAM console, choose Groups, and then choose Create New
Group.
2. On the Set Group Name page, enter a name for the group, such as SSMUserGroup or
another name that you prefer.
6
3. Choose Next Step.
6. On the Review page, verify that the correct policies are added to this group, and then
choose Create Group.
Taget Aoudince:
Handy Linux is a French distribution designed for novice Linux users. It is based on debian
GNU/Linux latest stable branch and it uses the Xfce desktop enviroment. The main feature of the
distribution is a custom start menu with applications and internet bookmarks grouped in tabs.
7
How to Install Handy Linux 2.
Handy Linux 2 Installation Steps:
3. Start installation
For example useradd test (as the root user - prefix with sudo if you are not logged in as root).
Killall
If you have a slow ‘Google Chrome’ and want to kill all running and open chrome instances, or
if you have a Notes app that is not responding, killall is an easy command that can help you.
Killall exactly matches the argument name by default and kills the matching process. Here is
how to use it. But remember that this command will not let the application save any data, so you
may lose data if you have not saved it.By default, the killall command is case-sensitive. But you
can use the -I option to ignore the case.
killall -I notes
Ctrl + x + e
If you want to write a long command, but you do not want to type it on your terminal for many
obvious reasons, this shortcut will help.
8
Ctrl + x + e will open an editor where you can type your command. And upon saving the editor,
the command will run on the terminal
EMACS
The editor that opens is known as Emacs. Emacs or EMACS is a family of text editors that are
characterized by their extensibility.
Some installations may not have the emacs readily available. You can download by running the
following command
touch
Touch is a pretty useful command in Unix. And in my 15 years of working in the software
industry, I have used it a ton of times.The most basic use of this command is to create an empty
file.
touch a
touch -r file_name2 file_name1
tee
The tee command in UNIX is a command-line utility for copying standard input to standard
output. It supports writing whatever it is given from standard input to standard output and
optional writing to one or more files. That’s especially helpful when you want to redirect data to
a file as well as see what's in the file.
fc
Suppose you want to edit a really long command that you just fired. Using the terminal will need
some effort. The ‘fc’ command solves this problem.
In the below example, I ran a curl command that had a typo. So I ran the fc command. The
previous command — curl opened in an editor; I fixed the command and saved the file. And the
curl command ran again with the results
9
sl
If you want to relieve the pressure after some hard hours at work, or you just want to stare at
something else, ‘sl’ is the command for you. Linux can be funny at times!!
brew install sl
Try and type ‘sl’ in the terminal and see what happens. For those who first want to see it before
trying it out themselves, here is a screenshot:
10