Mq/mysql/redis/nginx Common Services & Tools installation

Source: Internet
Author: User
Tags openssl openssl library unpack zookeeper iptables install redis redis server

Stand-alone 3.1 installation Tool 3.1.1 Install MAVEN tool 3.1.1 Upload installation package

1) root user create installation directory such as/usr/local/maven:

  mkdir -p /usr/local/maven

2) enter into the/usr/local/maven directory

  cd /usr/local/maven

3) upload the MAVEN installation package apache-maven-xx.xx.xx.tar.gz to the/usr/local/maven/directory as the root user

3.1.2 Unpacking the installation package

tar -zxvf apache-maven-XX.XX.XX.tar.gz

3.1.3 Configuring Environment variables

1) Modify the/etc/profile configuration file to add the following environment variable information

#Maven

maven_home=/usr/local/maven/apache-maven-3.5.0

Export Maven_home

Export Path=${path}:${maven_home}/bin

2) Save and source in effect

source /etc/profile

3.1.4 Checking the installation status

Run mvn-v to verify that MAVEN is installed successfully and print the following if the installation is successful:

[Email protected] maven]# mvn-v

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04t03:39:06+08:00)

Maven Home:/usr/local/maven/apache-maven-3.5.0

Java version:1.8.0_102, Vendor:oracle Corporation

Java Home:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64/jre

...

3.1.2 Installing the Git tool

1) direct root user execution: Yum install git

2) View the installed version: Git--version

git version 1.8.3.1

3.1.3 Installing the JDK

1. Check the default installation status

Java-version

The system defaults to the OPENJDK, which needs to be uninstalled and installed.

2. detecting JDK installation Packages

  Rpm-qa | grep java

Avapackages-tools-3.4.1-6.el7_0.noarch
Tzdata-java-2014i-1.el7.noarch
Java-1.7.0-openjdk-headless-1.7.0.71-2.5.3.1.el7_0.x86_64
Java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el7_0.x86_64
Python-javapackages-3.4.1-6.el7_0.noarch

3. uninstalling OpenJDK

RPM-E--nodeps Tzdata-java-2014i-1.el7.noarch

RPM-E--nodeps java-1.7.0-openjdk-headless-1.7.0.71-2.5.3.1.el7_0.x86_64

RPM-E--nodeps java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el7_0.x86_64

4. Install the new jdk1.8.0_31

Decompression tar.gz

Mkdir-p/USR/LIB/JVM

TAR-ZXVF jdk1.8.0_31.tar.gz-c/USR/LIB/JVM

5. Setting Environment variables

Vi/etc/profile

At the end of the file add:

Export java_home=/usr/lib/jvm/jdk1.8.0_31

Export JRE_HOME=${JAVA_HOME}/JRE

Export Classpath=.:${java_home}/lib:${jre_home}/lib

Export Path=${java_home}/bin: $PATH

If only temporary can be configured in the terminal, not configured in the configuration file, if only want a user can use, can only configure the profile file of that user;


6. make profile effective

Source/etc/profile

7. Check for newly installed JDK

Java-version

3.2 Installing dependent services 3.2.1 Installing Zookeeper3.2.1.1 uploading the installation package

1, the root user to create the installation directory, such as/usr/local/services/zookeeper:

 mkdir -p /usr/local/services/zookeeper

2. Enter into the/usr/local/services/zookeeper directory

 cd /usr/local/services/zookeeper

3. Upload the Zookeeper installation package zookeeper-xx.xx.xx.tar.gz to the root user

To the/usr/local/services/zookeeper directory

3.2.1.2 Unpacking the installation package

4. Unpack the installation package

tar -zxvf zookeeper-XX.XX.XX.tar.gz

3.2.1.3 Configuration

5. Enter into the/usr/local/services/zookeeper/zookeeper-xx.xx.xx/conf directory

6. Copy the Zoo_sample.cfg file and name it as Zoo.cfg:

cp zoo_sample.cfg zoo.cfg

7. Open the Zoo.cfg file with vim and modify the storage address of the data and log files to the actual address:

8, save zoo.cfg file.

9, modify the/etc/profile configuration file, add the Start command

# idea-zookeeper-3.4.10 Config start-2017-08-11

Export zookeeper_home=/usr/local/services/zookeeper/zookeeper-3.4.10/

Export path= $ZOOKEEPER _home/bin: $PATH

Export PATH

10. Save in effect

Source/etc/profile

3.2.1.4 Start Zookeeper

$ZOOKEEPER _home/bin/zkserver.sh Start

3.2.2 Installing Redis3.2.2.1 uploading the installation package

1, the root user to create the installation directory, such as/usr/local/services/redis:

 mkdir -p /usr/local/services/redis

2. Enter into the/usr/local/services/redis directory

 cd /usr/local/services/redis

3. redis-xx.xx.xx.tar.gz the Redis installation package to the/usr/local/services/redis directory as root user

3.2.2.2 Unpacking the installation package

4. Unpack the installation package

tar -zxvf redis-XX.XX.XX.tar.gz

5. Modify the folder name

mv redis-4.0.1 redis

3.2.2.3 Installation

6, check whether there is a dependent package (if there is an error, according to the error prompt processing)

make test

The correct return should be (slightly):

7. Go to the SRC directory and install Redis. If the error does not occur, the installation is successful, as shown in.

make install

3.2.2.4 starting Redis

redis-server & Start Redis, plus & to make Redis run in daemon mode

Note: Using a custom port, you need to start Redis as a specified profile, using a port.

redis-server/usr/local/services/redis/redis/redis-port. conf

9. Check the startup status to see if the port is in use

NETSTAT-NTLP |grep Port

10. (optional) Configure the Redis in the form of a service to avoid the need to find the installation path after the Linux system restarts to execute the start command.

[Email protected] redis]# Vi/etc/init.d/redis

# chkconfig:2345 10 90

#redis服务必须在运行级2, the 3,4,5 is turned on or off, the priority of the shutdown is 10, and the boot priority is 90.

# Description:start and Stop Redis

Path=/usr/local/bin:/sbin:/usr/bin:/bin

Export PATH

redisport=6379 #端口号, which is the default

Exec=/usr/local/services/redis/redis/src/redis-server #redis The location of the-server startup script, which can be found with Find or Whereis

REDIS_CLI=/USR/LOCAL/SERVICES/REDIS/REDIS/SRC/REDIS-CLI #redis-CLI The location of the client startup script, found with Find or Whereis

Pidfile=/var/run/redis.pid #用find或whereis找到

conf= "/usr/local/services/redis/redis/redis.conf" #redis the location of the. CONF configuration file, found with Find or Whereis

Auth= "1234"

Case "$" in

Start

If [-F $PIDFILE]

Then

echo "$PIDFILE exists, process is already running or crashed."

Else

echo "Starting Redis server ..."

$EXEC $CONF

Fi

If ["$?" = "0"]

Then

echo "Redis is running ..."

Fi

;;

Stop

if [!-F $PIDFILE]

Then

echo "$PIDFILE exists, process is not running."

Else

pid=$ (Cat $PIDFILE)

echo "Stopping ..."

$REDIS _cli-p $REDISPORT SHUTDOWN

Sleep 2

While [-X $PIDFILE]

Do

echo "Waiting for Redis to shutdown ..."

Sleep 1

Done

echo "Redis stopped"

Fi

;;

Restart|force-reload)

${0} stop

${0} start

;;

*)

echo "Usage:/etc/init.d/redis {start|stop|restart|force-reload}" >&2

Exit 1

Esac

11. (optional) Add permission, use script file can execute, command is: chmod 755/etc/init.d/redis

12. Check if the command is available/etc/init.d/redis {start|stop|restart|force-reload

13. Configure Redis to boot with system

1) Set daemonize in Redis.config to Yes to ensure the daemon is turned on:

Vi/usr/local/services/redis/redis/redis.conf

Change Daemonize from No to Yes. Save exit

Daemonize Yes

2) Set boot Chkconfig redis on

To open a remote connection:

in the Redis the configuration file redis.conf , locate bind localhost comment out.

--At this point, the Redis installation configuration is complete.

3.2.3 Installing MQ3.2.3.1 uploading the installation package

1) root user create installation directory such as/USR/LOCAL/SERVICES/MQ:

 mkdir -p /usr/local/services/mq

2) enter into the/USR/LOCAL/SERVICES/MQ directory

 cd /usr/local/services/mq

3) upload the MQ installation package apache-activemq-xx.xx.xx-bin.tar.gz to the/USR/LOCAL/SERVICES/MQ directory as root user

3.2.3.2 Unpacking the installation package

tar -zxvf apache-activemq-XX.XX.XX-bin.tar.gz

3.2.3.3 Start MQ

Entercd /usr/local/services/mq/apache-activemq-5.9.0/bin

Start./activemq start

3.2.3.4 Check Status

Under Default configuration:

8161 Port provides management console service,

61616 Port provides JMS service

http://IP:8161/admin/

Default login account admin, password default, if you need to modify your own changes

Shut down:

First find the ACTIVEMQ corresponding process:
Ps-ef | grep ACTIVEMQ
and kill the corresponding process.

3.2.4 Installing Nginx3.2.4.1 uploading the installation package

1) root user create installation directory such as/usr/local/services/nginx:

 mkdir -p /usr/local/services/nginx

2) enter into the/usr/local/services/nginx directory

 cd /usr/local/services/nginx

3) Upload the Nginx installation package nginx-xx.xx.xx.tar.gz to the/usr/local/services/nginx directory as the root user

3.2.4.2 Unpacking the installation package

tar -zxvf nginx-XX.XX.XX.tar.gz

3.2.4.3 Pre-installation configuration

Go to unzip directory, execute./configure --prefix=/usr/local/services/nginx 

Note: You need to specify a path here, otherwise it will be installed on the default path/usr/local/nginx

Before installing, the dependent services are checked to see if they are installed, and if they are not installed, they will be an error, as follows:

Nginx installation, dependent on 3 services:

    • 1. Gzip module requires zlib library (download: http://www.zlib.net/) zlib-1.2.8.tar.gz
    • 2. Rewrite module requires pcre library (download: http://www.pcre.org/) pcre-8.21.tar.gz
    • 3. The SSL function requires the OpenSSL library (download: http://www.openssl.org/) openssl-1.0.1.tar.gz

Can be installed by Yum with one click:

yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel

3.4.2.4 Installation

make

make install

3.2.4.5 start Nginx

After installation, start Nginx

/usr/local/services/nginx/sbin/nginx

If Linux opens a firewall, you need to release the port (default 80, please modify it yourself), the command is as follows:

Iptables-a output-p TCP--sport 80-j ACCEPT

Check the configuration:

Iptables–l–n

Restart Iptables Effective

Service Iptables Restart

3.2.4.6 Check Status

Common commands:

Restart

/usr/local/services/nginx/sbin/nginx–s Reload

Modifying a configuration file

Vi/usr/local/services/nginx/conf/nginx.conf

After you start Nginx, enter Http://IP in the browser to verify that the installation started successfully.

3.2.5 Loading MySQL3.2.5.1 Download installation package Https://dev.mysql/com/downloads/mysql

Note: Rpm-bundle.tar This package is a summary package, download this package to

3.2.5.2 Uploading the installation package

1) root user creates/usr/local/services/mysql folder and uploads files

 mkdir -p /usr/local/services/mysql

2) Unzip

tar -zxvf sql-5.7.19-1.el7.x86_64.rpm-bundle.tar

3.2.5.3 installing MySQL

1, check whether the environment is installed by default MySQL

For example, it is already installed by default and needs to be removed first

Uninstalling the system comes with the Mariadb-lib

Otherwise, the following error will be reported, causing the common installation to fail.

2. Perform the installation

Installation Order:

mysql-community-common-5.7.19-1.el7.x86_64.rpm
mysql-community-libs-5.7.19-1.el7.x86_64.rpm-- (dependent on common )
mysql-community-client-5.7.19-1.el7.x86_64.rpm-- (dependent on Libs )
mysql-community-server-5.7.19-1.el7.x86_64.rpm-- (dependent on the client , Common )

3.2.5.4 Initializing the database

mysqld --initialize    

New version of this method is recommended, the executive will generate random passwords in/var/log/mysqld.log

When the installation is complete, it is installed by default under/var/lib/mysql. If you need to change the installation path, you can mysql_install_db--datadir=/var/lib/mysql

3.5.5 changing the owning user and the group to which it belongs

增加mysql用户并修改默认密码

groupadd mysql

useradd  -r -g mysql mysql

passwd mysql

 

增加如下目录并赋权限:

chown mysql:mysql /var/lib/mysql –R

3.5.6 start MySQL

systemctl start mysqld.service

检查状态:

ps -ef |grep mysql

3.5.7 Initializing login Password

The newly installed database requires the initial login password to be configured:

/ETC/MY.CNF [mysqld] under Add Skip-grant-tables=1, skip permissions, restart Service

update mysql.user set authentication_string = password(‘新密码‘), password_expired = ‘N‘, password_last_changed = now() where user = ‘root‘;

flush privileges;

Go back to the my.cnf. Comment out the skip-grant-tables you just added, restart the service
mysql -u root -pEnter the password you just set again

Viewing the boot port

Mysql> show global variables like ‘port‘;

+---------------+-------+

| variable_name | Value |

+---------------+-------+

| Port | 3306 |

+---------------+-------+

1 row in Set (0.01 sec)

Mysql>

3.5.8 (optional) Modify the MySQL database to make the support table case-sensitive

The way that MySQL does not differentiate between table name capitalization is actually simple:

1. Log in with root, modify/ETC/MY.CNF

2. Add a line under [mysqld]: Lower_case_table_names=1

3. Restart the database to

Kill the process first, then execute:systemctl start mysqld.service

Mq/mysql/redis/nginx Common Services & Tools installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.