Try deploying Rails application to EC2-Part 2 (Server construction)-

About this article

This time we will build a server with EC2. The contents of the first part are assumed, so please check if you haven't done so yet. This time, we will describe the essential software such as node.js and Ruby in EC2 as if they have already been installed. https://qiita.com/kotobuki562/items/57ffbaadad8ec8d16a4f

Database preparation

This time we will use MariaDB. This is because the instance is running on Amazon Linux 2. You can think of it as a derivative of MYSQL.

Enter the following command to install the database. MariaDB can be installed with the yum command.

[ec2-user@ip-111-11-11-111 ~]$ sudo yum -y install mysql56-server mysql56-devel mysql56 mariadb-server mysql-devel

Start MariaDB with the systemctl command.

[ec2-user@ip-111-11-11-111 ~]$ sudo systemctl start mariadb

Let's check if it is started with the status command.

[ec2-user@ip-111-11-11-111 ~]$ sudo systemctl status mariadb

If "active (running)" is displayed in green letters, it is successful.

Database password setting

By default, the user name is "root", but you can set the password yourself. When you execute the following command, you will be asked various yes / no, so answer yes. When "New password:" is displayed, enter the password you have decided. Make a note so that you do not forget it.

[ec2-user@ip-111-11-11-111 ~]$ sudo /usr/bin/mysql_secure_installation

Let's connect to the database when we're done. After confirming the connection, let's exit with "exit".

[ec2-user@ip-111-11-11-111 ~]$ mysql -u root -p

This completes the EC2 database design. Next time, I would like to describe how to actually register and deploy the SSH key on GitHub.

Recommended Posts

Try deploying Rails application to EC2-Part 2 (Server construction)-
Try deploying Rails app to EC2-Part 2 (Deploy)-
Try deploying a Rails app on EC2-Part 1-
About rails application server
[Introduction] Try to create a Ruby on Rails application
How to terminate rails server
Rails web server and application server
Try to introduce OpenCV to Android application
Preparing to create a Rails application
Introducing full calendar to Rails application
Connect to Rails server with iPhone
Introduce two-factor authentication to your Rails application
Rails API server environment construction using docker-compose
Try deploying Zipkin in your Jersey (JAX-RS2) application
Rails Tutorial Chapter 1 From Zero to Deployment [Try]
Error deploying rails5 + Mysql to heroku with Docker-compose
Try to summarize the common layout with rails
NFS server construction
(Under construction) Try to build chef automate infra server using Docker on macbook Memo
What to do if the Rails server can't start
Deploy to Ruby on Rails Elastic beanstalk (Environment construction)
Rails6 I tried to introduce Docker to an existing application
[Ruby on Rails] From MySQL construction to database change
[Docker + Rails] How to deal with Rails server startup failure
Try to implement tagging function using rails and js