To make a backup of your SQL Database using MariaDB, you have to issue a simple command.
mysqldump -p database_name > database_name.sql
It will ask you to input your database password, and then you should find the database_name.sql in your home directory. Once you’ve backed up the file, you can download it just as you would any other file with SFTP.
Restoring an SQL Database with MariaDB and setting up CentOS 7
The next stage is to set up your new machine. If you’re using a host like bhost, you’ll want to create a temporary SSH from the website’s login panel.
Create temporary SSH passwd -- password
Assuming you already have a web development server at home with ssh keys set up, you can simply update your web server and upload the same folder you use with your home machine:
Yum update Upload .ssh folder with authorized_keys and known_hosts - found on web development server; CHMOD 644 Yum install nano nano /etc/ssh/sshd_config -- "PasswordAuthentication no"
This prevents people from logging into the machine without the required ssh key file.
You don’t need to restart sshd if you plan to restart the machine immediately afterwards; however, it is wise to know the command:
service sshd restart reboot
Next install and start httpd:
yum install httpd systemctl start httpd.service
Install the firewall, check its state and allow http/https access:
yum install firewalld firewall-cmd --state systemctl start firewalld.service firewall-cmd --zone=public --add-service=ssh --permanent firewall-cmd --zone=public --add-service=http --permanent firewall-cmd --zone=public --add-service=https --permanent firewall-cmd --reload firewall-cmd --zone=public --list-all firewall-cmd --zone=public --remove-service=http --permanent -- Purely to check it is working, firewall-cmd --reload firewall-cmd --zone=public --add-service=http --permanent -- If removed firewall-cmd --reload firewall-cmd --zone=public --list-all
Install MariaDB (it is a mySQL server) and start it:
yum install mariadb-server mariadb systemctl start mariadb
Setup MariaDB and install php and php-mysql:
mysql_secure_installation Enter (None) Set root password? [Y] -- MariaDB Password Hit return until the install is completed. systemctl enable mariadb.service yum install php php-mysql systemctl restart httpd.service yum search php-
Create a file to check php has installed correctly:
nano /var/www/html/info.php <?php phpinfo(); ?> IP/info.php
Check the file exists:
cd /var/www/html/ ls -a nano index.php
Unzip a backup of your website:
cd /root/ tar xzpf mysitebackup.tar.gz ls -a cp -Rp html/ /var/www/ cd /var/www/html/ ls -a cd /root/ ls -a
Log into mysql and restore the database:
mysql -u root -p MariaDB Password CREATE DATABASE yourdatabase_name; GRANT ALL ON yourdatabase_name.* TO wpuser@localhost IDENTIFIED BY 'yourpassword'; "wpuser" password - yourpassword SHOW DATABASES; exit -- exit mysql mysql -u root -p yourdatabase_name < yourdatabase_name.sql MariaDB Password
You’ll find certain permalinks won’t work:
nano /etc/httpd/conf/httpd.conf Search AllowOverride <Directory "/var/www"> AllowOverride All Require all granted </Directory> apachectl restart chmod 755 /var/www/html/wp-content/
Install php-gd to also help with permalinks:
yum install php-gd systemctl restart httpd.service
Make sure you delete wordpress cache if you used a plugin at the point of backing up your site.
systemctl enable httpd.service -- make it start at boottime sudo firewall-cmd --permanent --add-service=ssh sudo firewall-cmd --permanent --remove-service=ssh sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo chown -R apache:apache /var/www setsebool -P httpd_unified 1 reboot
Block spam bots from bad IPs:
firewall-cmd --permanent --add-rich-rule="rule family=ipv4 source address=220.127.116.11/8 reject" firewall-cmd --permanent --zone=public --list-all firewall-cmd --reload
Check the time and date, and fix it if is it incorrect:
# this is not correct for me date Wed Oct 1 07:43:58 CDT 2008 # to fix it sudo rm /etc/localtime sudo ln -s /usr/share/zoneinfo/Europe/London /etc/localtime # now check it's ok date
These commands assume you have already backed up some of your website.
Installing PHP 7.3 in CentOS 7:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm yum install yum-utils yum-config-manager --enable remi-php73 yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
Once these commands are used, you can then check your version number:
This should show PHP version 7.3. This doesn’t completely set up a system but it gets the basics up and running. Backing up WordPress, a MariaDB Database and Setting up CentOS does not take much time once you know all of the commands.
I find a lot of WordPress plugins unnecessary.Affiliate information.