I will describe the procedure to publish the application using AWS. In this article, we will build an environment for EC2 instances.
Install various tools to build the environment of EC2 instance.
Execute the following command to move to the ".ssh" directory.
cd ~/.ssh/
Execute the following command to access the EC2 instance with ssh. (When the downloaded pem file name is "xxx.pem" and the Elastic IP is 12.345.67.890)
ssh -i xxx.pem [email protected]
Run the following command to update the package.
sudo yum -y update
--A package is a collection of various programs and files required for the operation of the Linux OS. --Consists of a binary program and documents such as libraries, configuration files, and procedure manuals required to operate the program.
--In Linux distributions such as CentOS, a package management system called RPM (Red Hat Package Manager) is basically used. RPM packages can be easily installed, updated or uninstalled with the "rpm" command. ――YUM (Yellowdog Updater Modified) makes it possible to use RPM more conveniently by checking dependencies such as "This software is required to use certain software" and automatically installing the necessary software. YUM package operations are performed with the yum command. --There are various commands and options that can be used with the yum command, and the "yum -y update" performed above is a command that responds to all inquiries with "yes" and updates the system package.
Execute the following command to install various other packages required for environment construction.
sudo yum -y install git make gcc-c++ patch libyaml-devel libffi-devel
sudo yum -y install libicu-devel zlib-devel readline-devel libxml2-devel
sudo yum -y install libxslt-devel ImageMagick ImageMagick-devel
sudo yum -y install openssl-devel libcurl libcurl-devel curl
Node.js is for running Javascript on the server side. I would like to summarize the details in another article. Install to compress css and images in future work.
Execute the following command to install Node.js.
sudo curl -sL https://rpm.nodesource.com/setup_6.x | sudo bash -
sudo yum -y install nodejs
A command that exchanges data with the server. The frequently used options are as follows. I would like to summarize this in detail later.
-L --If there is a redirect, get the redirect destination information
-s --Do not output extra
-o --Specify the output destination of the response body
Bash is a type of shell that conveys user input to a computer. Here, bash is running.
The following is done when implementing the server side using Ruby.
Execute the following command to clone rbenv from git.
#Install rbenv
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
Execute the following command to pass the path. Passing the path means making the application callable from any directory.
#Pass through
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
#Description for calling rbenv
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
Execute the following command to read the set path.
#.bash_Load profile
source .bash_profile
Execute the following command to clone ruby-build from git.
#ruby-install build
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Execute the following command to rehash. In other words, commands that can be used by installing ruby and gem (irb, gem, rake, rails, ruby, etc.) are sorted by version so that they can be used.
#Do rehash
rbenv rehash
This time install version 2.5.1.
Execute the following command to install the 2.5.1 version of Ruby.
rbenv install 2.5.1
Execute the following command to determine the version of Ruby to use in the EC2 instance.
rbenv global 2.5.1
Execute the following command to perform side rehash.
#Do rehash
rbenv rehash
Finally, check if the installation is done properly with the following command.
#Check version
ruby -v
What is the yum command What is a package Node.js official Node.js explanation curl command
Procedure to publish application using AWS (1) Create AWS account Procedure to publish application using AWS (2) Create EC2 instance [Procedure to publish application using AWS (4) Create database] (https://qiita.com/osawa4017/items/7dba25f4fa30ab0b1246) [Procedure to publish application using AWS (5) Publish application] (https://qiita.com/osawa4017/items/6f3125fcc21f73024311) [Procedure to publish application using AWS (6) Install Nginx] (https://qiita.com/osawa4017/items/9b707baf6ddde623068c)
Recommended Posts