Compile and install the new version based on LNMP + wordpress build personal blog

First, the software introduced

  • Nginx + Mysql + Php site structure technology under the Linux system: On behalf of LNMP.

  • Linux System: free to use and free dissemination of Unix-like operating system, stable and reliable.

  • Nginx: high-performance HTTP reverse proxy and web servers, but also provides IMAP / POP3 / SMTP services.

  • Mysql: relational database management system, mariadb use this software, it is a branch of mysql, maintained by the open source community.

  • Php: Hypertext Preprocessor, is a versatile open source scripting language. Syntax absorbed the C language, Java, and Perl features conducive to learning, widely used, mainly for Web development.

  • WordPress: Use PHP language development blog platform, users can set up on a server that supports PHP and MySQL database of their own website.

Second, the installation preparation:

The installation by a virtual machine, software versions as follows:

centos system version: 7.6.1810
nginx-1.16.0.tar.gz
MariaDB-10.2.23.tar.gz
PHP-7.3.5.tar.bz2
WordPress-5.0.3-zh_CN.tar.gz

Sure to turn off selinux, off the firewall.
Source configured yum, EPEL source, in order to install each software dependencies.

Third, compile and install:

Compile and install mariadb:

1. yum mounting mariadb dependencies:

yum install bison bison-devel zlib-devel libcurl-devel libarch
ive-devel boost-devel gcc gcc-c++ cmake ncurses-devel gnutls-devel libxml2-devel openssl-devel libevent-devel libaio-devel -y

2. Prepare mysql user and data storage directory:

useradd -r -s /sbin/nologin -d /data/mysql mysql
chown mysql.mysql /data/mysql

3. Go to the source package directory, compile:

tar xvf mariadb-10.2.23.tar.gz
cd mariadb-10.2.23/
[root@centos7 mariadb-10.2.23]# cmake . \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_DATADIR=/data/mysql/ \
-DSYSCONFDIR=/etc/mysql \
-DMYSQL_USER=mysql \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITHOUT_MROONGA_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0 \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBWRAP=0 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci

make && make install

4. Set Environment Variables

vi /etc/profile.d/mysql.sh
export PATH=/apps/mysql/bin:$PATH

source /etc/profile.d/mysql.sh

5. Prepare the profile database and generates the initialization file

[root@centos7 mysql]# ./scripts/mysql_install_db --datadir=/data/mysql --user=mysql
[root@centos7 apps]# cp /apps/mysql/support-files/my-huge.cnf /etc/my.cnf

6. Prepare startup script

[root@centos7 apps]# cp /apps/mysql/support-files/mysql.server /etc/init.d/mysqld

7.mysql boot authentication

[root@centos7 apps]# service mysqld start

So far, mysql already can log in normally:
Compile and install the new version based on LNMP + wordpress build personal blog

Compile and install nginx:

1. yum install nginx dependencies:

[root@centos7 nginx-1.16.0]# yum install -y vim lrzsz tree screen psmisc lsof tcpdump wget ntpdate gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools iotop bc zip unzip zlib-devel bash-completion nfs-utils automake libxml2 libxml2-devel libxslt libxslt-devel perl perl-ExtUtils-Embed

2. Go to the directory source package to be compiled:

[root@centos7 nginx-1.16.0]# ./configure --prefix=/apps/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-pcre \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module

make && make install

3. Create nginx running account:

[root@centos7 nginx-1.16.0]# useradd nginx -s /sbin/nologin -u 2000
[root@centos7 nginx-1.16.0]# chown -R nginx.nginx /apps/nginx/
[root@centos7 nginx-1.16.0]# ln -sv /apps/nginx/sbin/nginx /usr/sbin/

4. Start nginx:

[root@centos7 nginx-1.16.0]# nginx
[root@centos7 nginx-1.16.0]# ss -tunl | grep 80

To verify the client browser:
Compile and install the new version based on LNMP + wordpress build personal blog

Compile and install php:

1. yum installed php dependencies:

yum install -y libxml2-devel openssl-devel libcurl-devel libjpeg-turbo-devel libpng-devel freetype-devel gmp-devel bzip2-devel libmcrypt-devel libzip-devel

2. Go to the php source package to be compiled:

[root@centos7 src]# cd php-7.3.5/

[root@centos7 php-7.3.5]# ./configure --prefix=/apps/php \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-pear \
--with-curl \
--with-png-dir \
--with-freetype-dir \
--with-iconv \
--with-mhash \
--with-zlib \
--with-xmlrpc \
--with-xsl \
--with-openssl \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--disable-debug \
--enable-mysqlnd \
--enable-zip \
--enable-sockets \
--enable-soap \
--enable-inline-optimization \
--enable-xml \
--enable-ftp \
--enable-exif \
--enable-wddx \
--enable-bcmath \
--enable-calendar \
--enable-shmop \
--enable-dba \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg

Note After this step, the system upgrade libzip require more than version 0.11, the latest version is installed yum 0.9.
Find the latest libzip-1.5.2 from the official website, https://libzip.org/

Compile and install the new version based on LNMP + wordpress build personal blog
After starting the compiler, there was another problem, the cmake display version is too low.
Compile and install the trouble to find almost dead, still cmake to compile it? After searching online, find another way is to reduce libzip version on the line, the following were selected libzip-1.3.2 compiler.

Remove libzip -Y-devel yum
wget https://libzip.org/download/libzip-1.3.2.tar.gz
the tar-xvf libzip 1.3.2.tar.gz
CD-libzip 1.3.2
./configure
the make -j 4
the make install
half-way there is no error, libzip rely problem solved.

Then re-execute ./configure --prefix = / apps / php ...
this step, this one is not being given.
[root @ centos7 php-7.3.5] #make && make install

3. Prepare the php configuration file:

[root@centos7 apps]# cd php/etc/php-fpm.d/
[root@centos7 php-fpm.d]# mv www.conf.default www.conf #生成php-fpm的配置文件

[root@centos7 php-7.3.5]# cp php.ini-production /apps/php/etc/php.ini #从源码安装目录负责php的配置文件到安装目录

[root@centos7 etc]# cp php-fpm.conf.default php-fpm.conf

4. 创建php的运行账号:

[root@centos7 php-7.3.5]# useradd -r -s /sbin/nologin www

5. 检查语言启动php-fpm:

[root@centos7 etc]# /apps/php/sbin/php-fpm -t
[02-Jun-2019 20:10:26] NOTICE: configuration file /apps/php/etc/php-fpm.conf test is successful

[root@centos7 etc]# /apps/php/sbin/php-fpm -c /apps/php/etc/php.ini
[root@centos7 etc]# ps -ef | grep php-fpm
[root@centos7 etc]# ss -tanlp | grep php-fpm

php-fpm已正常启动。

6.配置nginx支持php-fpm:

[root@centos7 nginx]# vi /apps/nginx/conf/nginx.conf

Compile and install the new version based on LNMP + wordpress build personal blog

启用nginx主配置文件中的php配置,并修改。
Compile and install the new version based on LNMP + wordpress build personal blog

7.准备php的测试页面:

[root@centos7 html]# vi index.php
Compile and install the new version based on LNMP + wordpress build personal blog

8. Restart nginx, php access status page:

Compile and install the new version based on LNMP + wordpress build personal blog

Above, LNMP site environment on the deployment is complete.

Deploying Personal blog software wordpress:

1. Extract the software ready to install wordpress:

cd /usr/local/src/
cp -r wordpress /apps/nginx/html/

2. Prepare for wordpress php configuration file:

[root @ centos7 wordpress] # cp WP-config-sample.php WP-config.php
[root @ centos7 wordpress] # # vi WP-config.php configuration database account information wordpress
Compile and install the new version based on LNMP + wordpress build personal blog

3. authorized access to the information database of wordpress:

Compile and install the new version based on LNMP + wordpress build personal blog

Use wpuser account login database to verify:

Compile and install the new version based on LNMP + wordpress build personal blog

4. Access the web page, install wordpress:

Compile and install the new version based on LNMP + wordpress build personal blog

Compile and install the new version based on LNMP + wordpress build personal blog

Compile and install the new version based on LNMP + wordpress build personal blog

The above is based on LNMP + wordpress personal blog system.

Guess you like

Origin blog.51cto.com/13932385/2404514