linux Installation of nginx, jdk, redis

Keywords: Linux Nginx Redis JDK Java

Because the project needs to apply for a new server, it is necessary to reconfigure the environment.

nginx installation:

  1. One click installation of four dependencies:
    yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

     

  2. Enter / usr/local/src directory and create nginx folder
    cd /usr/local/src
    mkdir nginx

     

  3. Enter the nginx directory you just created and download the nginx tar package
    cd nginx
    wget https://nginx.org/download/nginx-1.17.9.tar.gz

    Unexpectedly, my prompt [error: Certificate common name "*. nginx.com" does not match the required host name "nginx. Org". To connect to nginx.org in an insecure way, use '- no check certificate'.

    Modify download command

    wget --no-check-certificate https://nginx.org/download/nginx-1.17.9.tar.gz



  4. decompression

    tar -zxvf nginx-1.17.9.tar.gz

     

  5. Enter the directory generated by decompression for configuration

    cd nginx-1.17.9
    ./configure



  6. Compilation and installation

    make
    make install

     

  7. Find installation path

    whereis nginx

     

  8. nginx.conf partial configuration

    #Configure the maximum number of open files for Nginx worker process
    worker_rlimit_nofile 65535;
    events {
        #Maximum number of client connections allowed for a single process
        worker_connections  8192;
    }
    
    
        #Log log configuration
        access_log  /opt/nginx-logs/access.log  main;
        error_log   /opt/nginx-logs/error.log ;
    
    
        #Set load balancing background server list
        upstream wxsd1.unisk.cnxx {
            ip_hash;
            server 127.0.0.1:8081 max_fails=3 fail_timeout=5s;
            #server 127.0.0.1:8082 max_fails=3 fail_timeout=5s;
            server 127.0.0.1:8083 max_fails=3 fail_timeout=5s;
            server 127.0.0.1:8084 max_fails=3 fail_timeout=5s;
            #server 127.0.0.1:8085 max_fails=3 fail_timeout=5s;
        }

 

 

jdk installation:

  1. Check whether the jdk that comes with linux is installed
    java  -version

    You can see it's OpenJDK

  2. View jdk installation package
    rpm -qa | grep java

     

  3. Uninstall OpenJDK
    yum remove *openjdk

     

  4. Install Oracle JDK
    Download address: https://www.oracle.com/java/technologies/javase-downloads.html
    In the / usr/local directory, create the java installation directory
    cd /usr/local
    mkdir java

    Use xftp to upload the downloaded jdk-8u231-linux-x64.tar.gz file to this directory

     

  5. decompression
    tar -zxvf jdk-8u231-linux-x64.tar.gz

     

Because the previous project uses jdk1.7, download and install jdk1.7 in the same way

  

 

Configure environment variables

  1. Configure jdk to / etc/profile to access jdk in any directory
    vim /etc/profile

     

    Press i to enter editing, and add the following content at the end of profile file:

    export JAVA_HOME=/usr/local/java/jdk1.7.0_80  #jdk installation directory
    export JRE_HOME=${JAVA_HOME}/jre
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
    export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
    export PATH=$PATH:${JAVA_PATH}

    Save and exit editing, ESC -- >: WQ

  2. Execute profile file (read and execute commands in profile in current bash environment)
    source /etc/profile

     

  3. Test whether the installation is successful
    java -version
    javac

     

     

     

     

redis installation:

  1. Enter / usr/local/src directory and create redis folder
    cd /usr/local/src
    mkdir redis

     

  2. Install redis
    Visit download address: https://redis.io/download
    Upload the downloaded redis-5.0.8.tar.gz to the new redis folder through the remote management tool

     

     

  3. decompression
    tar -zxvf redis-5.0.8.tar.gz

     

  4. Enter the directory of the generated files and perform make compilation
    cd redis-5.0.8
    make

     

  5. Perform the make install installation (the software can specify the installation directory)
    make PREFIX=/usr/local/redis install

     

  6. redis start and stop commands:
    #Enter the / usr/local/redis/bin directory and execute the redis server script file
    ./redis-server
    
    #Turn off redis services
    pkill  redis-server
    
    #Set redis to run in the background, modify the redis.conf configuration file, and set the daemonize option from no to yes

     

Knock off.

Posted by jasonman1 on Sun, 05 Apr 2020 14:12:46 -0700