The installation log of Nginx, MariaDB and PHP7

The make && make install of MariaDB is in process, it will take a long time. Let’s take a break.

–So I just write down this log.

To be honest it is very handy to keep such a technical blog, as you can use your blog as a notebook. Lmao.

1.Installing NGINX

You know how it is. Install the compile tools, then dependencies. Download the source pack, unzip, configure, make and install then add to the startup.

Tools and dependencies

yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre-devel

Add user and group

sudo groupadd -r nginx
sudo useradd -s /sbin/nologin -g nginx -r nginx

Download source pack and unzip

No way. Bro. Just go to NGINX.org for the latest version.

Configure, make and make install

./configure --prefix=/usr/local/nginx--conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_v2_module

If you don’t need HTTPS support (Oh come on!),  remove the --with-http_ssl_module

Remember to make && make install

Add to the start up

Save the configuration below into /lib/systemd/system/nginx.service

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

2.Installing PHP7

Execute rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org && rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm && yum install epel-release -y first and you are going to thank me one day.

Tools and dependencies

yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel libc-client-devel

ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so

Download source pack and unzip

No way again! Bro. Just go to PHP.NET for the latest version.

Configure, make and make install

go into the folder of your PHP

./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--enable-fpm \
--with-fpm-user=nginx  \
--with-fpm-group=nginx \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared  \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir  \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets  \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcache \
--with-imap=imap \
--with-kerberos \
--with-imap-ssl

Remember to make && make install

Then vi /etc/profile and add the text below to the bottom of this file.

PATH=$PATH:/usr/local/php/bin
export PATH

source /etc/profile will make the changes take effect instantly.

Add to the start up

cp php.ini-production /etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp sapi/fpm/php-fpm /usr/local/sbin/php-fpm
chmod +x /usr/local/sbin/php-fpm

and edit or create /lib/systemd/system/php-fpm.service

[Unit]
Description=PHP FastCGI process manager
After=local-fs.target network.target nginx.service

[Service]
PIDFile=/run/php/php-fpm.pid
ExecStartPre=/bin/mkdir –parents /run/php
ExecStart=/usr/local/sbin/php-fpm –nodaemonize –fpm-config /usr/local/php/etc/php-fpm.conf
Type=simple

[Install]
WantedBy=multi-user.target

Leave a Reply

Your email address will not be published. Required fields are marked *