It's annoying to google every time, so I'll write an article as a memorandum.
If there are no critical services running on the server, update your system first.
sudo dnf -y upgrade
The command to add a repository for an x86_64 CPU machine is:
sudo tee /etc/yum.repos.d/MariaDB.repo<<EOF
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos8-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
By the way, in the case of RHEL8, the following command.
sudo tee /etc/yum.repos.d/MariaDB.repo<<EOF
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/rhel8-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
The command is as follows.
sudo dnf install boost-program-options
sudo dnf install MariaDB-server MariaDB-client --disablerepo=AppStream
sudo systemctl enable --now mariadb
By the way, in the case of RHEL8, it is as follows.
sudo dnf install boost-program-options
sudo dnf install MariaDB-server MariaDB-client --disablerepo=rhel-8-for-x86_64-appstream-rpms
sudo systemctl enable --now mariadb
It seems to be initialized with the following command.
sudo mysql_secure_installation
By the way, the message was different between the site I referred to and the environment at hand, so I will post a log.
[root@localhost vagrant]# sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] n
... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
The installation is now complete.
[root@localhost vagrant]# mysql --version
mysql Ver 15.1 Distrib 10.4.17-MariaDB, for Linux (x86_64) using readline 5.1
I tried it in a Vagrant + VirtualBox environment, but I can't mount it because of dnf upgrade
.
When I searched for it, it said that I should use the following command, but none of them worked.
The environment is as follows.
VirtualBox version 6.1.16 r140961 (Qt5.6.2)
Vagrant 2.2.13
CentOS Linux release 8.2.2004 (Core)
Insert the Vagrant plugin
vagrant plugin install vagrant-vbguest
#It wasn't normal
vagrant up {vagrant global-ID found by status}
#I also saw this so I tried it
vagrant vbguest {vagrant global-ID found by status}
#It didn't work even if I restarted
vagrant reload {vagrant global-ID found by status}
Reinstall plugin
vagrant plugin expunge --reinstall
#It didn't work even if I started it with this
vagrant up {vagrant global-ID found by status}
#Try updating again on CentOS
dnf update
#I tried rebooting after this but it didn't work
vagrant reload {vagrant global-ID found by status}
As a result of various trials, it was finally fixed when the following was implemented. It was good.
#Plugin installation
vagrant plugin install vagrant-vbguest
#Reboot for the time being (not fixed at this stage)
vagrant reload {vagrant global-ID found by status}
#ssh connection
vagrant ssh {vagrant global-ID found by status}
#Install the one around the kernel
dnf install epel-release
dnf install kernel-devel kernel-headers gcc perl make dkms
#Exit ssh and restart again
vagrant reload {vagrant global-ID found by status}
Recommended Posts