Prepare the environment of CentOS 8 with Sakura VPS


If you subscribe to Sakura VPS, the environment will be CentOS 7 by default. If you want to use it with much effort, a new environment is good, so prepare an environment for CentOS 8.

CentOS 8 setup

Various settings-> OS installation

スクリーンショット 2020-10-02 19.48.20.png

Select a custom OS and select CentOS 8 x86_64 as the installation OS.

スクリーンショット 2020-10-02 19.48.45.png

Press the button to execute the installation.

スクリーンショット 2020-10-02 19.49.06.png

After waiting for a while, the start button of the VNC console will be displayed at the bottom of the screen, so press it. Make two settings, Language Support and Installation Destination.

スクリーンショット 2020-10-02 19.53.21.png

First, select Japanese in Language Support and Done

スクリーンショット 2020-10-02 19.54.31.png

Select the red frame displayed on the Installation Destination screen and delete all (press the - button).

スクリーンショット 2020-10-02 20.00.00.png

If you delete it, it looks like this.

スクリーンショット 2020-10-02 20.00.39.png

Click here to create them automatically Click the link

スクリーンショット 2020-10-02 20.01.51.png

If you are particular about it, set the partition yourself, otherwise press the Done button

スクリーンショット 2020-10-02 20.03.08.png

Press the Accept Changes button

スクリーンショット 2020-10-02 20.28.06.png

Press the Begine Installation button

スクリーンショット 2020-10-02 20.03.33.png

The installation screen will appear, so set the Root Password here.

スクリーンショット 2020-10-02 20.03.47.png

Set any password and Done

スクリーンショット 2020-10-02 20.05.56.png

If you want to create it other than the root user, create it and Done

スクリーンショット 2020-10-02 20.07.07.png

A screen like an error appears, but this state seems to be the state of installation completion.

スクリーンショット 2020-10-02 20.24.51.png

Press the start button from the Sakura VPS control panel

スクリーンショット 2020-10-02 20.16.39.png

Since my environment is Mac, start Terminal and check the SSH connection with the following command.

$ ssh [email protected]
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:abcde99zxyJ1jMEtDSr8DZC6GzrmvExoE1oPoySlw30.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '' (ECDSA) to the list of known hosts.
[email protected]'s password: 

$ less /etc/redhat-release 

CentOS Linux release 8.2.2004 (Core) 
/etc/redhat-release (END)

For the time being, only the installation of CentOS 8 is completed.

Various initial settings

For the time being, dnf update

$ sudo dnf -y update

You should have taken regular training from your system administrator.
This is usually summarized in three points::

    #1)Respect the privacy of others.
    #2)Think before typing.
    #3)Great power comes with great responsibility.

[sudo]yamaguchi password:
Final confirmation of metadata expiration: 0:07:It was held 40 hours ago on October 02, 2020 at 20:28:01.
The dependency has been resolved.
There is nothing to do.
Has completed!

There is no particular update

Check Time Zone

It's kind to Japanese people. It's already Asia / Tokyo.

$ timedatectl status
               Local time:Fri 2020-10-02 20:37:22 JST
           Universal time:Fri 2020-10-02 11:37:22 UTC
                 RTC time:Fri 2020-10-02 11:37:21
                Time zone: Asia/Tokyo (JST, +0900)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Locale confirmation

Oh, this is en_US.UTF-8.

$ localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: jp106
      X11 Layout: jp
$ sudo localectl set-locale LANG=ja_JP.UTF-8
[[email protected] ~]$ localectl status
   System Locale: LANG=ja_JP.UTF-8
       VC Keymap: jp106
      X11 Layout: jp

I'll put Vim in

$ sudo dnf -y install vim

Secure connection settings with SSH Keys

Create an RSA key pair in the terminal on the client machine (Mac).

Commands on Mac

$ cd ~/.ssh
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/you_name_is_yu/.ssh/id_rsa): sakura_id_rsa
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in sakura_id_rsa.
Your public key has been saved in
The key fingerprint is:

$ ls -la | grep sakura
-rw-------   1 you_name_is_yu  staff  2675 10  2 20:56 sakura_id_rsa
-rw-r--r--   1 you_name_is_yu  staff   592 10  2 20:56

RSA key pair made on Mac

Commands on Mac

$ ssh-copy-id -i [email protected]

/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ""
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password: 

Number of key(s) added:        1

Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

At this point, the key has been uploaded to the specified account on the Sakura VPS server. Let's check it just in case.

Sakura VPS command

$ cd ~/.ssh
$ $ ls

Now when you connect to ssh from the Mac side, you can log in with key authentication without entering ID / PASS.

Mac terminal

$ ssh [email protected] -i ~/.ssh/sakura_id_rsa
Last login: Fri Oct  2 20:52:39 2020 from

I wasn't asked for my password.

Disable SSH connection on root account

Sakura VPS

# sudo cp -p /etc/ssh/sshd_config /etc/ssh/
# sudo vim /etc/ssh/sshd_config


PermitRootLogin no  # yes ->Change to no

Restart sshd when the settings are complete

$ sudo systemctl restart sshd

Make sure you can't ssh as root. OK if you get Permission denied as shown below

Mac terminal

$ ssh [email protected]
[email protected]'s password: 
Permission denied, please try again.

Of course, it is possible to access from the console from the control panel of Sakura VPS, so It's okay if you make a mistake and even a normal user can't connect to ssh, let alone root.

For the time being, I think that the basic part of the CentOS 8 environment has been set.

Sakura VPS packet filter settings

In the environment we are building this time, we are assuming a web application with nginx + php, so we need to be able to connect to ports 80 and 443. By default, it seems that none of the ports are open, so set that.

Press the button to packet filter settings

スクリーンショット 2020-10-03 7.53.00.png

Select to use packet filter> Select Web from filter usage> Press the button to save settings

スクリーンショット 2020-10-03 7.54.19.png

When the setting is completed, the packet filter tab will be displayed as follows.

スクリーンショット 2020-10-03 7.55.35.png

** With this setting, it seems that SSH will not be connected this time, so it seems that SSH also needs to be set in the packet filter. ** **

In addition to the packet filter, it seems that you have to set http / https in the firewall setting of CentOS 8 as well.

$ sudo firewall-cmd --add-service=http --zone=public --permanent
$ sudo firewall-cmd --add-service=https --zone=public --permanent
$ sudo firewall-cmd --reload

By doing this, I was able to move to the Nginx Welcom page for the time being.

Recommended Posts

Prepare the environment of CentOS 8 with Sakura VPS
Prepare Python3 environment with CentOS7
Prepare the format environment with "Rails" (VScode)
Prepare the execution environment of Tomcat in IntelliJ Community
Prepare the environment for java11 and javaFx with Ubuntu 18.4
[Vagrant] Prepare LAMP development environment with Vagrant (centos + apache + MySQL + PHP)
Prepare Java development environment with Atom
I tried to build the environment of PlantUML Server with Docker
Prepare Java development environment with VS Code
Use Priority Queue with Kotlin (1.0.0) of AtCoder (+ Investigate the environment of the judge server)
Check the contents of params with pry
Prepare the security check environment for Rails 6
About the treatment of BigDecimal (with reflection)
Format the contents of LocalDate with DateTimeFormatter
I had a hard time installing MariaDB 10.5.5 on CentOS 8 of Sakura VPS
[Memo] Create a CentOS 8 environment easily with Docker
Self-hosting with Docker of AuteMuteUs in Windows environment
Improve the performance of your Docker development environment
Manage the version of Ruby itself with rbenv
Overwrite the contents of config with Spring-boot + JUnit5
Calculate the similarity score of strings with JAVA
Prepare a scraping environment with Docker and Java
Support out of support in docker environment using centos6
Specify the default value with @Builder of Lombok
Measure the distance of the maze with breadth-first search
Build a Java runtime environment on Sakura VPS
[CentOS 8] About the work when rebuilding ConoHa VPS
I checked the number of taxis with Ruby
Graph the sensor information of Raspberry Pi and prepare an environment that can be checked with a web browser
How to use git with the power of jgit in an environment without git commands
Use the --build-arg option of docker-compose to pass environment variables to the container built with Dockerfile
The procedure I did when I prepared the environment of gradle + Java with VS Code (Windows 10)
[Rough explanation] How to separate the operation of the production environment and the development environment with Rails
[Swift] Get the number of steps with CMP edometer
List the contents of categories created with Active Hash
JavaFX --Match the size of ImageView with other nodes
CI the architecture of Java / Kotlin applications with ArchUnit
Docker the development environment of Ruby on Rails project
Build an environment of Ruby2.7.x + Rails6.0.x + MySQL8.0.x with Docker
Access the built-in h2db of spring boot with jdbcTemplate
Test the contents of an Excel file with JUnit
The story of making a reverse proxy with ProxyServlet
How to install the root certificate of Centos7 (Cybertrust)
Build ruby debug environment with VS Code of Windows 10
[CentOS] Download and build the specified version of Git
Monitor the internal state of Java programs with Kubernetes
Implement the UICollectionView of iOS14 with the minimum required code.
Check the behavior of Java Intrinsic Locks with bpftrace
Environment construction of Rails5 + MySQL8.0 + top-level volumes with docker-compose
[First team development ③] Share the development environment created with Docker
[Java] Get the file in the jar regardless of the environment
Make Nginx of CentOS8 SSL compatible with Let's Encrypt
Check the result of generic parameter inference with JShell
How to boot by environment with Spring Boot of Maven
SSL in the local environment of Docker / Rails / puma
Roughly the flow of web application development with Rails.
Control the processing flow of Spring Batch with JavaConfig.
Comfortable Docker environment created with WSL2 CentOS7 and Docker Desktop
Debug the VSCode + Docker + PHP development environment with XDebug.
The story of making dto, dao-like with java, sqlite
Replace only part of the URL host with java