centos install LNMP environment

Article directory Install lnmp project deployment environment Installing the python environment Install mysql Install nginx Install redis redis boot ...
Install python environment
Install mysql
Install nginx
Install redis

Article directory

Install lnmp project deployment environment

Install python environment

  • Install python Library

    pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com -r requirements.txt
  • Install Python dependencies

    yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
  • Release file:

    tar -xvzf Python-3.5.6.tgz
  • Enter the directory:

    cd Python-3.5.6/
  • Add configuration: (configure your own installation directory here)
    /configure --prefix=/usr/local/python

  • Next, compile the source code:

    make

  • Perform the installation:

    make altinstall

    We need to install Python 2.7.5 ourselves. But it is worth noting that we must not destroy the environment of the system. Because several key utility applications rely on Python 2.4.3. If the python environment of the system is replaced, many unforeseen errors will occur, leading to system reinstallation.

  • Soft link
    A very important step is that we use make altinstall. If you use make install, you will see that there are two different versions of Python on the system in the / usr/bin / directory. This will lead to many problems and is not easy to deal with.

    Although we can use the commands of python3 and pip3 in this path (/ usr/local/python3.6.3/bin), or use them in any path after adding the path environment variable, we should always add "3" instead of the usual Python and pip.

    Toggle (modify default link)
    The python and pip commands we usually use are in the / usr/bin / directory, so,
    We need to make the python and pip commands here soft link to our python 3 and pip3 commands.

    There are two ways (choose 1 from 2):

    1. Manual
    2. By command
    Manual:
    1),# cd /usr/bin
    2) , MV python. Back / / back up the original Python
    3),# ln -s /usr/local/bin/python3.6 /usr/bin/python
    4),# ln -s /usr/local/bin/python3.6 /usr/bin/python3

  • Modify files that depend on python2 after changing the soft connection

  • View pyhton environment

Install mysql

yum -y install mariadb-service

  • Starting MariaDB service and setting its startup

  • Change password and start \ sview configuration

    mysqladmin -uroot password "root"
    mysql -uroot -proot

  • Change to utf8 character set

    vim /etc/my.cnf

  • Restart mysql

    systemctl restart mariadb.service

Install nginx

wget http://nginx.org/download/nginx-1.9.9.tar.gz

Install dependency package

yum -y install gcc gcc-c++ openssl-devel pcre-devel httpd-tools
//Executive order ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_mp4_module --with-http_flv_module

Compile and install

make && make install

Soft connection

-s /usr/local/nginx/sbin/nginx /usr/sbin/

Start nginx and view

[root@Lucky nginx]# cd ~ [root@Lucky ~]# nginx [root@Lucky ~]# netstat -anptu | grep nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 23794/nginx: master

View port

netstat -ntlp

View nginx profile

./nginx -t


Close nginx

nginx -s quit

Alibaba cloud ECS needs to set 80 ports to open

Install redis

redis boot

[root@lucky bin]# pwd /usr/local/redis/bin [root@lucky bin]# redis-server /usr/local/redis/redis.conf 2579:C 11 Jan 2020 20:52:50.705 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 2579:C 11 Jan 2020 20:52:50.705 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=2579, just started 2579:C 11 Jan 2020 20:52:50.705 # Configuration loaded
Wang Da Yang 143 original articles published, 38 praised, 40000 visitors+ Private letter follow

15 January 2020, 00:24 | Views: 7014

Add new comment

For adding a comment, please log in
or create account

0 comments