How to deploy new wordpress site on centos 7
Task will be completed in this lab
1 => Install http/apache server
2 => Install mysql server
3 => Install php
4 => Install wordpress
5 => Deploy app1.makelinuxinteresting.com on wordpress
Let's Start
Step 1 — Installing http/Apache Server
Open your terminal and login with root user or use sudo
by running below command.
you have to run below command to enable allow http in iptable.
# firewall-cmd --zone=public --permanent --add-service=https
# firewall-cmd --reload
# iptables -L
* Now open your server ip in browser to check default page
http://192.168.1.2/
Note: Change Server IP according to your server IP .
* Now create a virtual host for your website app1.makelinuxinteresting.com
#mkdir /var/www/html/app1
#vim /etc/httpd/conf.d/app1.makelinuxinteresting.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin admin@makelinuxinteresting.com
ServerName app1.makelinuxinteresting.com
ServerAlias www.app1.makelinuxinteresting.com
DocumentRoot /var/www/html/app1
ErrorLog /var/log/httpd/app1.makelinuxinteresting.com-error.log
CustomLog /var/log/httpd/app1.makelinuxinteresting.com-access.log combined
<Directory /var/www/html/app1>
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.app1.makelinuxinteresting.com[OR]
RewriteCond %{SERVER_NAME} =app1.makelinuxinteresting.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
AllowOverride All
</Directory></VirtualHost>
Press esc and :wq enter to save file
* Create a DNS A record in your hosting provider or if you want to resolve it locally edit in your
host file
for windows : c:\windows\system32\drivers\etc\hosts
For linux or mac : vim /etc/hosts
Step 1 Result : Now you can see you are able to open default page of https/apache server .
# httpd -t
* if no error found restart httpd service
#systemctl restart httpd
* run below command to check website configuration
#httpd -S
: Now open app1.makelinuxinteresting.com to verify .
Step 2 — Installing mysql 5.7 server
A – Now you have to enable MySQL Repository by below command
# yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
B - Now You have to Install MySQL 5.7 Server by running below command
# yum install mysql-community-server
C - Now enable mysql service on startup and start mysql service by below commands.
# systemctl enable mysqld
# systemctl start mysqld
# systemctl status mysqld
Note : After installing MySQL 5.7 Server default root password will be set to see default pass you have to run below command .
# grep 'A temporary password' /var/log/mysqld.log |tail -1
D – Now you can Login to MySQL by using default pass
mysql> use mysql;
mysql> grant select,insert,delete,create,update on *.* to wp_user@‘localhost’ identified by "Xmr@3HCP9rs3My34";
can give any name according to you. I'm using wordpress
Step 3 — Install php packages
A : Install yum-utils and enable EPEL repository
B : Download and Install remirepo using yum command
C : Now enable configuration for PHP 7.3 repository, use below command
Step 4 — Installing Wordpress
B - Now extract latest.tar.gz file by below command
D - Now change permission by below command
#chmod 777 -R /var/www/html/app1/
#chown apache:apache -R /var/www/html/app1/
Step 5 — Deploy app1.makelinuxinteresting.com on wordpress
A : Now open http://app1.makelinuxinteresting.com/wp-admin/setup-config.php
in your browser
No comments:
Post a Comment