Installing mariadb. How to set up MariaDB SSL and establish secure connections from various clients


This article "Installing MariaDB 10 on CentOS 7" will show you how to install and configure MariaDB 10 on CentOS 7. As you probably already know, MariaDB database server is now by default on CentOS because of Oracle (parent company MySQL) and GPL licensing issues. MariaDB is open source and the community is gradually moving away from MySQL to MariaDB.

If you don't know the story, here's a quick recap. Prior to Oracle owning MySQL, it was based on the GPL (GNU General Public License), which says that you can use the software for free, but you cannot modify or sell it unless you donate the source code. This means you can use it in your closed source project.

When Oracle changed the licensing agreement from the GPL model, most of the open source community revolted and some started a group from MySQL and created MariaDB.

So basically, the MariaDB database server is the same as MySQL, but with a GPL licensing model.

Now that you know a little more about why and how MariaDB was founded, let's learn how to install it on CentOS 7.

Installing MariaDB on CentOS 7

Now, MariaDB is the default database server for CentOS, all you have to do is run the following commands to install it. The problem is that centos downloads and installs an older but stable version of MariaDB.

If you want to install the latest version of MariaDB, you need to add its software repository to your computer and install. To do this, run the following commands to create a file from the repository.

$ sudo vim /etc/yum.repos.d/MariaDB.repo

Then copy and paste the lines below into the file and save it.

Name = MariaDB baseurl = http://yum.mariadb.org/10.0/centos7-amd64 gpgkey = https: //yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck = 1

Finally, run the commands below to install MariaDB 10 on your server:

$ sudo yum install MariaDB-server MariaDB-client

If you are having problems with errors and MariaDB cannot be installed due to a conflict with mariadb-libs-xxxx, run the command below to remove the conflicting libraries, and then re-run the installation of the command above:

$ sudo yum remove mariadb-libs *

You should also remove the Postfix package. Re-run the command above to install MariaDB.

After the installation is complete, run the command below to start the server with MariaDB:

$ sudo /etc/init.d/mysql start

Then run the following command to secure the database server.

$ sudo mysql_secure_installation

Then select "Y" (Yes) for the rest of the prompts until you're done.

Enter current password for root (enter for none): press Enter Set root password? Y New password: Type new root password Re-enter new password: Confirm the password Remove anonymous users? Y Disallow root login remotely? Y Remove test database and access to it? Y Reload privilege tables now? Y

Lastly, you need to replace the default cnf.ini file in / etc / for MariaDB. But first you need to go to:

$ cd / usr / share / mysql

And use one of the predefined cnf.ini configurations that are available (Huge, Medium and Small) in this folder.

Let's make a backup copy of the cnf.ini file:

$ sudo mv /etc/cnf.ini /etc/cnf.ini.bak

Then copy one of the preconfigurations in MariaDB:

$ sudo cp /usr/share/mysql/my-huge.cnf /etc/cnf.ini

Restarting MaraiDB:

$ systemctl restart mysql

You can check the status:

$ systemctl status mariadb

You can add MariaBD to OS startup:

$ systemctl enable mariadb

I need to create a user and so that he can connect from any computer, for this:

$ mysql -uroot -u> GRANT ALL PRIVILEGES ON *. * TO "captain" @ "%" IDENTIFIED BY "my_password" WITH GRANT OPTION; > exit

Let's check which port MariaDB is listening on using the SS command:

# ss -tnlp | grep 3306 LISTEN 0 0 127.0.0.1:3306 *: * users: (("mysqld", 1159.14))

Mine looks like this (I allowed remote connection to the DB server):

LISTEN 0 50 *: 3306 *: * users: (("mysqld", 10884.13))

Installation of MariaDB 10 on CentOS 7 is now complete.

January 2, 2017 12:16 pm 13,224 views | no comments

Requirements

  • CentOS 7 server.
  • User with sudo access.

All necessary instructions can be found in.

Step 1 - installing MariaDB

To install MariaDB, use the Yum repository. Run the following command and press y to continue.

sudo yum install mariadb-server

After the installation is complete, start the daemon:

sudo systemctl start mariadb

The systemctl command does not show the output of some commands. To make sure the daemon is running, enter:

sudo systemctl status mariadb

If the MariaDB daemon was started, the command output will contain the lines:

Active: active (running)
[…]
Dec 01 19:06:20 centos-512mb-sfo2-01 systemd: Started MariaDB database server.

Now you need to configure MariaDB to autostart. To do this, enter:

sudo systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

After that, you need to ensure the security of the data.

Step 2: securing MariaDB

After the installation is complete, you need to run the MariaDB built-in security script, which changes some of the default options and blocks the remote root login. To run the script, enter:

sudo mysql_secure_installation

The script provides a detailed description of each step. First, it will ask for the root password. Since there is no such password in the new installation yet, just press Enter. The script then prompts you to create such a password. Enter a strong password and confirm it.

The script then asks you a series of questions. To accept the default data, you can simply press Y and Enter. The script will block anonymous users and remote root login, delete test tables and reload privileges.

Step 3 - Testing MariaDB

Now we need to make sure that the MariaDB installation was successful.

Try connecting to the DB using the mysqladmin tool (this is the client for running administration commands). To connect to MariaDB as root (-u root), enter the password (-p) and request the version of the program, enter the command:

mysqladmin -u root -p version

The command will output:

mysqladmin Ver 9.0 Distrib 5.5.50-MariaDB, for Linux on x86_64
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Server version 5.5.50-MariaDB
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 4 min 4 sec
Threads: 1 Questions: 42 Slow queries: 0 Opens: 1 Flush tables: 2 Open tables: 27 Queries per second avg: 0.172

This means that the MariaDB installation was successful.

Conclusion

You should now be able to perform basic MariaDB installation and configuration.

Now I will tell you how to install MariaDB on Debian. I will also tell you how to use it in my topic "Installing MariaDB on Debian" all this will be described in detail.

MariaDB is a lightweight replacement for MySQL. MariaDB is analogous to MySQL and aims to be the best choice for database professionals looking for reliable, scalable SQL Server. This guide will help beginners install and understand how MariaDB works on Debian 7 and 6. To achieve this goal, the MariaDB Foundation works closely and collaborates with a large community of users and developers in the true spirit of free and open source software, and releases software in such a way that it was highly reliable.

The impetus for the creation was the need to ensure the free status of the DBMS (under the GPL license), as opposed to the undefined policy of MySQL licensing by Oracle. Lead Developer - Michael Widenius, author of the original MySQL version and founder of Monty Program AB.

MariaDB has deprecated the InnoDB storage subsystem and replaced it with XtraDB. Also included are Aria (en: Aria (storage engine)), PBXT and FederateX subsystems.

First, let's update the OS (so that everything is the latest):

# apt-get update # apt-get upgrade

Installing Python add-ons:

# sudo apt-get install python-software-properties

Installing MariaDB

First, you need to import the GPG key in order for APT to check the integrity of the packages and download everything:

# apt-key adv --recv-keys --keyserver hkp: //keyserver.ubuntu.com: 80 0xcbcb082a1bb943db

Create our own MariaDB sources.list file to add the repository to it:

# vim /etc/apt/sources.list

Installing MariaDB 5.5 for Debian 7 wheezy

# MariaDB 5.5 repository list - created 2014-11-15 17:08 UTC deb http://mirror.23media.de/mariadb/repo/5.5/debian wheezy main deb-src http://mirror.23media.de/mariadb /repo/5.5/debian wheezy main

Installing MariaDB 5.5 for Debian 6 squeeze

# MariaDB 5.5 repository list - created 2014-11-15 17:14 UTC deb http://mirror.23media.de/mariadb/repo/5.5/debian squeeze main deb-src http://mirror.23media.de/mariadb /repo/5.5/debian squeeze main

Installing MariaDB 10.0 for Debian 7 wheezy

# MariaDB 10.0 repository list - created 2014-11-15 17:21 UTC deb http://mirror.23media.de/mariadb/repo/10.0/debian wheezy main deb-src http://mirror.23media.de/mariadb /repo/10.0/debian wheezy main

Installing MariaDB 10.0 for Debian 6 squeeze

# MariaDB 10.0 repository list - created 2014-11-15 17:22 UTC deb http://mirror.23media.de/mariadb/repo/10.0/debian squeeze main deb-src http://mirror.23media.de/mariadb /repo/10.0/debian squeeze main

Installing MariaDB 10.1 for Debian 7 wheezy

# MariaDB 10.1 repository list - created 2014-11-15 17:23 UTC deb http://mirror.23media.de/mariadb/repo/10.1/debian wheezy main deb-src http://mirror.23media.de/mariadb /repo/10.1/debian wheezy main

Installing MariaDB 10.1 for Debian 6 squeeze

# MariaDB 10.1 repository list - created 2014-11-15 17:23 UTC deb http://mirror.23media.de/mariadb/repo/10.1/debian squeeze main deb-src http://mirror.23media.de/mariadb /repo/10.1/debian squeeze main

After that, update the system (list of all repositories) and install the server with MariaDB:

# sudo apt-get update # sudo apt-get install mariadb-server

After that, the installation of the MariaDB server will begin. I chose 10.0 version and for this, I will give an example of installation. During installation, you will be asked for the password for the MariaDB user - root.

Enter the password and click OK. You also need to enter the 2nd time (confirmation). The installation process will take a couple of minutes.

Using MariaDB

In this section, you will learn how to connect to MariaDB and how to use basic SQL commands.

The standard tool for interacting with MariaDB is the MySQL client program. First, run the following command to connect to MariaDB as root user:

# mysql -u root -p

Enter the password that you entered (created) during installation.

Let's try to create a simple database that we will later populate with data. Enter the following commands to create a database named TEST_DB, owned by the new user Test_User, and set the secret_password for the user using the command:

MariaDB [(none)]> CREATE DATABASE test_db; MariaDB [(none)]> GRANT ALL PRIVILEGES ON test_db. * TO [email protected] IDENTIFIED BY "secret_password"; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> quit

The last line (command) logs out from the root user on MariaDB. And now we will login as user test_user:

# mysql -u testuser -p

Let's enter the command in order to use the newly created database (test_db):

MariaDB [(none)]> USE test_db;

Create a new table and fill it with some data:

MariaDB [(none)]> CREATE TABLE products (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR (255), price DECIMAL (6,2)); MariaDB [(none)]> INSERT INTO products (name, price) VALUES ("MacBook_Pro", 3200.0); MariaDB [(none)]> INSERT INTO products (name, price) VALUES ("Asus", 340.0); MariaDB [(none)]> INSERT INTO products (name, price) VALUES ("HP", 745.0);

Make sure the new data is inserted normally:

MariaDB [(none)]> SELECT * FROM products;

Exit the MariaDB client by running:

MariaDB [(none)]> quit

For more information on SQL commands, run:

MariaDB [(none)]> \ h

Configuring MariaDB

To configure MariaDB, you need to edit the configuration file. This file controls most of the server's system variables, which you usually leave by default.

# vim /etc/mysql/my.cnf

restart the server by running the following command:

# service mysql restart

MariaDB security

# mysql_secure_installation

You will be prompted to change the administrator password, remove anonymous, deny logins outside the localhost, remove all anonymous, and remove the test database. It is recommended that you answer "Y" to all questions.

Remote user connections

Let's take a look at how to allow the previously created Test_User to connect to MariaDB remotely (by default, MariaDB only allows connections from the local host).

Opening the MariaDB server to the Internet makes it less secure. If you need to connect from a different server, then make sure you have applied firewall rules to only allow connections from specific IP addresses.
First, we need to provide custom connections to remote hosts for the Test_user user, for this we need to be logged into MariaDB as root:

# mysql -u root -p

Allow Test_User to connect from remote hosts:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON test_db. * TO [email protected]"%" IDENTIFIED BY "secret_password"; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> quit

Configuring MariaDB to listen on all network interfaces. Open the /etc/mysql/my.cnf file:

# vim /etc/mysql/my.cnf

[…]
bind-address = 0.0.0.0
[…]

Restart the server:

# service mysql restart

Testing the connection from the local machine to your MariaDB server, replacing Test_User with your username, and test_domain.com with your domain or IP address:

# mysql -u test_user -h test_domain.com -p

If you are successfully logged in, you should see the MariaDB welcome and shell prompt.

Tuning MariaDB

The MySQL Tuner is a useful tool that connects to a running MariaDB instance and provides configuration recommendations based on workload. You must let your MariaDB instance run for at least 24 hours before starting the tuner. The longer the copy has been running, the better advice the tuner will offer you.

Install MySQL tuner by running the following command:

# apt-get install mysqltuner

Start the MySQL tuner with the following command:

# mysqltuner

After which he will give you a lot of very useful information. Pay attention to the recommendations at the end. This will tell you what to change (which variables should be configured) in the section of your /etc/mysql/my.cnf file.

How to reset MariaDB root password?

If you have forgotten your superuser password (root password), you can easily reset it by following the instructions below.

Stop the MariaDB server:

# service mysql stop

Start the server with skip-grant-tables, this way you can login to MariaDB without a password:

# mysqld_safe --skip-grant-tables &

You can now connect to the MariaDB server as root without a password:

# mysql -u root

In the MariaDB client, enter the following commands to reset the superuser password and log out:

MariaDB [(none)]> USE mysql MariaDB [(none)]> UPDATE user SET password = PASSWORD ("yournewpassword") WHERE user = "root"; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> quit

Restart the MariaDB server:

# service mysql restart

Connect to the MariaDB server using the new password:

# mysql -u root -p

The installation of MariaDB on Debian is now complete. I hope it was clear.

In this article we will look at how to install and configure Linux, Apache, MariaDB, PHP on Centos7 / RHEL 7. There are many changes in the new version of Centos7 / RHEL 7.

What is LAMP?

LAMP is a software suite based on an OS consisting of a Linux operating system, an Apache web server, a MySQL database server, and the PHP (or Perl / Python) programming language. LAMP is used to run heavy, dynamic websites made entirely of free and open source software. In this article, I am going to explain how Linux, Apache, MySQL / MariaDB (replacement for MySQL), PHP (LAMP) are installed on CentOS 7 or RHEL 7.

  • Install RHEL 7 or CentOS 7 server. Open a terminal to the server via ssh, you must have root superuser rights.
  • You will also need knowledge of yum commands
  • You will need the IP address of your server, use the following command to determine the IP address for the eth0 interface
ifconfig eth0 or ip a show eth0 or ip addr list eth0 | awk "/ inet / (sub (/ \ / + /," ", $ 2); print $ 2)" or ifconfig eth0 | awk "/ inet / (print $ 2)" 10.180.10.10
  • The resulting IP 10.180.10.10 address will be used to test the installation

So let's get started

Installing Apache on a CentOS 7 / RHEL 7 server

To install the web server, use the command

Yum install httpd

Enable the HTTPd service at startup

systemctl enable httpd.service ln -s "/usr/lib/systemd/system/httpd.service" "/etc/systemd/system/multi-user.target.wants/httpd.service"

To disable automatic loading

Systemctl disable httpd.service rm "/etc/systemd/system/multi-user.target.wants/httpd.service"

Start HTTPd service on CentOS 7 / RHEL 7

systemctl start httpd.service

At this point, you can point your web browser to the IP address of your server, http://10.180.10.10. You will see the apache start page:

Stopping HTTPd service on CentOS 7 / RHEL 7

systemctl stop httpd.service

Restarting HTTPd service on CentOS 7 / RHEL 7

Viewing apache service status on CentOS 7 / RHEL 7

Make sure the web server is running

Systemctl status httpd.service

Also restarting the web server can be done with the following command

Apachectl graceful

Checking apache / httpd for configuration errors in Centos 7 / RHEL 7

Apachectl configtest

Default configuration of HTTPD server:

  1. Default config file: /etc/httpd/conf/httpd.conf
  2. Configuration files for loaded modules: /etc/httpd/conf.modules.d/ (e.g. PHP)
  3. Select MPMs as loadable modules and events: / etc / httpd / conf.modules.d / 00-mpm.conf
  4. Standard ports: 80 and 443 (SSL)
  5. Default log files: / var / log / httpd / (access_log, error_log)

Installing MariaDB on a CentOS 7 / RHEL server

MariaDB is an updated replacement for MySQL Server. RHEL / CentOS 7 uses MariaDB database management system instead of MySQL. Enter the following yum command to install MariaDB server:

Yum install mariadb-server mariadb

To start MariaDB, use the command:

Systemctl start mariadb.service

To ensure that the MariaDB service starts automatically at boot time, enter:

Systemctl enable mariadb.service

Command output

Ln -s "/usr/lib/systemd/system/mariadb.service" "/etc/systemd/system/multi-user.target.wants/mariadb.service"

To stop / restart and shutdown MariaDB use the following commands:

Sudo systemctl stop mariadb.service # - Stop mariadb server sudo systemctl restart mariadb.service # - Start mariadb server sudo systemctl disable mariadb.service # - Disable autoloading mariadb server sudo systemctl is-active mariadb.service # - Check running is the server?

Starting MariaDB for the first time

Enter the following command:

/ usr / bin / mysql_secure_installation

By answering the questions, you will be able to configure the initial database security

Verifying MariaDB installation

Enter the following command

Mysql -u root -p

Output example:

Installing PHP on CentOS 7 / RHEL 7

To install PHP and modules such as GD / mysql enter the following command

Yum install php php-mysql php-gd php-pear

You need to restart the HTTPD (Apache) server, enter:

Systemctl restart httpd.service

To find all other PHP modules:

Yum search php-

To get more information about a module:

Yum info php-pgsql

PHP check on the server

Create a file called /var/www/html/test.php like this:

Vi /var/www/html/test.php

Add the following code:

LAMP server is installed, if you have problems with setting up the server, we do one-time work on installing and configuring the LAMP web server.

Today we will be engaged in raising one of the most demanded roles of any linux server, which occupy a leading role in this functional segment. Configuring a CentOS 7 web server based on a bundle of a popular http server apache, interpreter php and database server mysql, or in short, setting lamp. This bundle is the most popular configuration among web hosting today. Although lately the same company has been stepping on its heels, but on the basis of nginx, it may have already outstripped it, I do not have exact data on this score.

This article is part of a single series of articles about the server.

Web server on CentOS 7

So, our centos web server will consist of three main components - the http server apache, the interpreter of the programming language php and database server mysql... Let's get to know each of them a little:

  1. Apache- http server or just apache web server. It is cross-platform software that supports almost all popular operating systems, including Windows. It is prized primarily for its reliability and configuration flexibility, which can be significantly expanded thanks to plug-ins, of which there are a great many. Among the shortcomings, they note that they are more demanding on resources, compared to other servers. Apache will not be able to keep the same load as, for example, nginx with similar hardware parameters.
  2. PHP Is a general-purpose programming language that is most often used in web development. It is by far the most popular language in this field of application. Supported by almost all hosting providers.
  3. Mysql- database management system. Has gained its popularity among small and medium-sized applications, of which there are a lot on the web. So, like php, it is by far the most popular database used on web sites. Supported by most hosting providers. On CentOS, instead of mysql, install mariadb Is a fork of mysql. They are fully compatible, it is possible at any time to switch from one subdivision to another and vice versa. Recently I have come across information that mariadb works faster than mysql and people are slowly moving to it. In practice, I have not been able to observe this, since I have never worked with loaded databases. And under normal conditions, the difference is not noticeable.

The experimental server will be, the characteristics are as follows:

CPU2 cores
Memory8 Gb
Disk150 Gb SSD

This is a custom parameter setting. They are not optimal for the price, but they were exactly what I needed.

I want to clarify right away that I am analyzing the basic default setting. To improve performance, improve reliability and usability, you need to install a few more tools, which I will discuss separately. In general, what is in this article will be enough to organize a web server.

If you don't have a server yet, then you need to execute. And if the server is already installed, then do not forget it. I recommend that you pay attention to the settings, since there is a lot of useful information that I do not give within the framework of this article - updating the system, configuring the firewall, installing the editor, and much more.

Configuring apache on CentOS 7

On CentOS, the apache service is called httpd... When I first got acquainted with this distribution kit, it was unusual for me. In Freebsd and Debian, with which I worked before, the web server service was called apache, although somewhere I noticed, it seems in a fry, that the configuration file is named httpd.conf. Until now, I do not know why both of these names have spread. I would be glad if someone shared information on this with me in the comments.

Now let's get down to installing apache... CentOS 7 makes this very easy:

# yum install -y httpd

Add apache to startup:

# systemctl enable httpd

Launch apache on CentOS 7:

# systemctl start httpd

Check if the server has started:

# netstat -tulnp | grep httpd tcp6 0 0 ::: 80 ::: * LISTEN 21586 / httpd

Everything is in order, hung on the 80th port, as it should be. Already now you can go to the address http: // ip-address and see the picture:

Now let's start configuring apache. I prefer the following web hosting structure:

Let's create a similar structure:

# mkdir / web && mkdir /web/site1.ru && mkdir /web/site1.ru/www && mkdir /web/site1.ru/logs # chown -R apache. / web

IncludeOptional conf.d / *. Conf

If not, uncomment and go to the /etc/httpd/conf.d directory. Create the site1.ru.conf file there:

ServerName site1.ru ServerAlias ​​www.site1.ru DocumentRoot /web/site1.ru/www Options FollowSymLinks AllowOverride All Require all granted ErrorLog /web/site1.ru/logs/error.log CustomLog /web/site1.ru/logs/access.log common

Restarting apache on centos

Now we restart apache:

# systemctl restart httpd

If there are any errors, look at the apache log / var / log / httpd / error_log. If everything is in order, then check if our virtual host is configured properly. To do this, create in the folder /web/site1.ru/www index.html file with the following content:

# mcedit /web/site1.ru/www/index.html

Apache is tuned!

# chown apache. /web/site1.ru/www/index.html

192.168.1.25 site1.ru

where 192.168.1.25 is the ip address of our web server.

Now in the browser we type the address http://site1.ru. If we see a picture:

then everything is configured correctly. If there are any errors, then we go to look at the logs. And in this case, not the general httpd log, but the error log of a specific virtual host at /web/site1.ru/logs/error.log.

Immediately I would like to draw your attention to configuring the rotation of virtual host logs. It often happens that if you don't set it up right away, then you forget. But if the site has good traffic, then the logs will grow rapidly and can take up a lot of space. It is better to configure the rotation of the web server logs immediately after creation. This is not difficult to do.

To configure rotation of virtual host logs, you need to edit the /etc/logrotate.d/httpd file. It is created during the apache installation and includes setting up the rotation of the default location of the logs. And since we transferred the logs of each virtual host to an individual folder, you need to add these folders to this file:

# mcedit /etc/logrotate.d/httpd /web/*/logs/*.log/ var / log / httpd / * log (missingok notifempty sharedscripts delaycompress postrotate / bin / systemctl reload httpd.service> / dev / null 2> / dev / null || true endscript)

Basically, the simplest web server is already ready and can be used. But now there are hardly any sites with static content that only need html support. So let's continue with our setup.

If you need to organize the work of the site according to the protocol https, then use the manual for.

Installing php on CentOS 7

To support dynamic site content, let's take the next step. Install php on CentOS 7:

# yum install -y php

And then there are a few more useful components. Install popular modules for php:

# yum install -y php-mysql php-mbstring php-mcrypt php-devel php-xml php-gd

Let's restart apache:

# systemctl restart httpd

Let's create a file in the virtual host directory and test php:

# mcedit /web/site1.ru/www/index.php# chown apache. /web/site1.ru/www/index.php

We go to the address http://site1.ru/index.php

You should see the output of php information. If something is wrong, there were some errors, see the virtual host error log, php errors will be there too.

Where is php.ini

After installation, the question often arises, where are php settings stored? Traditionally, they are located in a single settings file. On CentOS php.ini is in / etc, right at the root. There you can edit the global settings for all virtual hosts. Personal settings for each site can be done separately in the virtual host configuration file that we made earlier. Let's add some useful settings there:

# mcedit /etc/httpd/conf.d/site1.ru.conf

Add to the very end, before

Php_admin_value date.timezone "Europe / Moscow" php_admin_value max_execution_time 60 php_admin_value upload_max_filesize 30M

To apply the settings, you need to restart apache. You can now see the settings change in the phpinfo output.

Upgrading to php 5.6 on CentOS 7

In our example, we installed on CentOS 7 php 5.4 from the standard repository. And what if we need a newer version, for example php 5.6? In this case, you need to update php.

# wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm # rpm -Uvh remi-release-7 * .rpm

Now upgrade php 5.4 to php 5.6:

# yum --enablerepo = remi, remi-php56 install php php-common php-mysql php-mbstring php-mcrypt php-devel php-xml php-gd

Restart apache:

# systemctl restart httpd

And let's go watch the phpinfo output - http://site1.ru/index.php

Great, we have updated php to version 5.6.

Installing MySQL on CentOS 7

As I wrote earlier, a fork of mysql is becoming more widespread now - mariadb... It has full compatibility with mysql, so you can safely use it. This is what I prefer to use.

Install mariadb on CentOS 7:

# yum install -y mariadb mariadb-server

Add mariadb to autorun:

# systemctl enable mariadb.service

Launch mariadb:

# systemctl start mariadb

We check whether it started or not:

# netstat -tulnp | grep mysqld tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 22276 / mysqld

I draw your attention to the fact that even in the system it is displayed as a mysqld service. Now we run the standard security configuration script:

# / usr / bin / mysql_secure_installation

I will not give the entire output of this script, everything is quite simple and clear there. First, set a password for root (the current password after installation is empty), then delete anonymous users, disable the ability to connect to root remotely, delete the test user and the database.

File settings mysql / mariadb lies in /etc/my.cnf... The default settings are sufficient for normal operation. But if you decide to change them, remember to restart the database service.

Restarting mariadb/ mysql on CentOS 7:

# systemctl restart mariadb

That's all. The basic functionality of the web server on CentOS 7 is configured.

I would be glad to receive remarks and comments on the topic of the article. Let me remind you that this article is part of a single series of articles about the server.

Kali Linux Workshop

A course for those who are interested in conducting penetration tests and want to practically try themselves in situations close to real ones. The course is designed for those who do not yet have experience in information security. Training lasts 3 months, 4 hours a week. What this course will give you:
  • Search and exploit vulnerabilities or configuration flaws in corporate networks, web sites, servers. Emphasis on Windows penetration testing and corporate security.
  • Explore tools like metasploit, sqlmap, wireshark, burp suite and many more.
  • Mastering the Kali Linux toolkit in practice - any information security specialist should be familiar with it.
Test yourself on the entrance test and see the details of the program on.






2021 gtavrl.ru.