Centos7.3 build wordpress by compiling and installing LAMP Based on source code
Software environment:
Apr-1.6.2.tar.gz
Apr-util-1.6.0.tar.gz http://apr.apache.org/
Httpd-2.4.27.tar.bz2 http://httpd.apache.org/
Php-7.1.10.tar.xz http://php.net/
Mariadb-10.2.8-linux-x86_64.tar.gz http://mariadb.org/
Wordpress-4.8.1-zh_CN.tar.gz https://cn.wordpress.org/
1. Install Httpd2.4 through source code compilation
(1) install the package group and Package
Yum groupinstall "development tools"
Yum installopenssl-devel expat-devel pcre-devel
(2) decompress the package
Tar xvf apr-1.6.2.tar.gz
Tar xvf apr-util-1.6.0.tar.gz
Tar xvf httpd-2.4.27.tar.bz2
(3) Compilation and installation:
Cp-r apr-1.6.2 httpd-2.4.27/srclib/apr
Cp-r apr-util-1.6.0 httpd-2.4.27/srclib/apr-util
Cd httpd-2.4.27/
. /Configure -- prefix =/app/httpd24 -- sysconfdir =/etc/httpd24 -- enable-so -- enable-ssl -- enable-rewrite -- with-zlib -- with-pcre -- with-embedded DED -apr -- enable-modules = most -- enable-mpms-shared = all -- with-mpm = prefork
Make-j 4 & make install
(4) modify the PATH
Vim/etc/profile. d/lamp. sh
PATH =/app/httpd24/bin/: $ PATH
./Etc/profile. d/lamp. sh effective modification
Echo $ PATH to check whether it takes effect
(5) start the service
Apachectl start the service
Ss-tnl check whether port 80 is enabled
2. Install mariadb in binary mode
(1) decompress the package to the fixed directory/usr/local/
Tar xvf mariadb-10.2.8-linux-x86_64.tar.gz-C/usr/local/
(2) create a soft connection, or change the mariadb-10.2.8-linux-x86_64 directory name to mysql, must be mysql
Cd/usr/local
Ln-s mariadb-10.2.8-linux-x86_64/mysql
(3) create a mysql user
Useradd-r-m-d/app/mysqldb-s/sbin/nologin mysql
(4) generate a database
Cd mysql/
Scripts/mysql_install_db -- datadir =/app/mysqldb -- user = mysql
(5) modify the configuration file
Mkdir/etc/mysql
Cp support-files/my-large.cnf/etc/mysql/my. cnf
Vim/etc/mysql/my. cnf Add the following three lines
[Mysqld]
Datadir =/app/mysqldb database location
Innodb_file_per_table = ON specifies a folder for a database table
Skip_name_resolve = ON Skip name resolution
(5) Add a service
Cp support-files/mysql. server/etc/init. d/mysqld
Chkconfig -- add mysqld add service
Chkconfig -- list to check whether the configuration is successfully added
(6) create a log
Mkdir/var/log/mariadb
Chown mysql/var/log/mariadb/
Service mysqld start
(7) modify the PATH
Vi/etc/profile. d/lamp. sh
PATH =/app/httpd24/bin/:/usr/local/mysql/bin/: $ PATH
./Etc/profile. d/lamp. sh
Mysql_secure_installation run the Security script
(8) Create a database
Mysql-uroot-pcentos
Create datebase wpdb;
Grant all on wpdb. * to wpuser @ '192. 192.% 'identified by 'cento ';
Grant all on wpdb. * to wpuser @ '192.% 'identified by 'cento ';
Grant all on wpdb. * to wpuser @ 'localhost' identified by 'cento ';
3. Compile and install Php with source code
(1) install the dependency package
Yum install libxml2-devel bzip2-devel libmcrypt-devel (epel)
(2) Extract
Tar xvf php-7.1.10.tar.xz
(3) Compile and install
Cd php-7.1.10/
./Configure \
-- Prefix =/app/php \
-- Enable-mysqlnd \
-- With-mysqli = mysqlnd \
-- With-openssl \
-- With-pdo-mysql = mysqlnd \
-- Enable-mbstring \
-- With-freetype-dir \
-- With-jpeg-dir \
-- With-png-dir \
-- With-zlib \
-- With-libxml-dir =/usr \
-- Enable-xml \
-- Enable-sockets \
-- With-apxs2 =/app/httpd24/bin/apxs \
-- With-mcrypt \
-- With-config-file-path =/etc \
-- With-config-file-scan-dir =/etc/php. d \
-- Enable-maintainer-zts \
-- Disable-fileinfo
Make-j 4 & make install
(4) modify the configuration file
Cp php. ini-production/etc/php. ini
Vim/etc/httpd24/httpd. conf
Add two lines at the end of the file
AddType application/x-httpd-php. php
AddType application/x-httpd-php-source. phps
Modify the following line
<IfModule dir_module>
DirectoryIndex index. php index.html
</IfModule>
(5) restart the service
Apachectl stop
Apachectl
4. Test the connection between php and mariadb.
Vim/app/httpd24/htdocs/index. php
<?php
$mysqli
=newmysqli(
"localhost"
,
"root"
,
"centos"
);
if
(mysqli_connect_errno()){
echo
"An error occurred while connecting to the database! "
;
$mysqli
=null;
exit
;
}
echo
"Database connected! "
;
$mysqli
->close();
phpinfo();
?>
5. Configure wordpress
(1) Extract
Tar xvf wordpress-4.8.1-zh_CN.tar.gz-C/app/httpd24/htdocs
(2) cd/app/httpd24/htdocs
Mv wordpress/blog/
Note: If you want to access http: // 192.168.191.107/, visit the blog, mvwordpress/*/app/httpd24/htdocs.
(3) modify the configuration file
Cd/app/httpd24/htdocs/blog/
Cp wp-config-sample.php wp-config.php
Vim wp-config.php.
define(
'DB_NAME'
,
'wpdb'
);
/** MySQL database username */
define(
'DB_USER'
,
'wpuser'
);
/** MySQL Database Password */
define(
'DB_PASSWORD'
,
'centos'
);
/** MySQL host */
define(
'DB_HOST'
,
'localhost'
);
6. logon Test
Http: // 192.168.191.107/blog
Enter blog Information