Install Linux centos7 system and jdk, mysql, rabbitmq, fastdfs, Nginx, ffmpeg, Redis, etc.

The front of the manual is in text form, which is directly copied from Word. If it is not easy to view, you can download the original from my personal center, or check the screenshot in Word form at the back, below

1.2 Centos7 system installation
(1) Insert the prepared U disk to the server
(2) Start the server, press F10 (keys are different for different motherboard servers) during the boot process, enter the bios interface, and set the U disk as the first boot disk
(3) Enter the boot menu interface, find the U disk and select it, click F10 to save and start
(4) Enter the system disk interface, select the first enter, and an error will be reported after entering

(5) A dracut-initqueue timeout error occurs, then the cd /dev system, the ls command to check the disk situation, find the memory at the beginning of sdb or sda, and then reboot back to the initial interface and press e to enter to modify the startup parameters, set inst.stage2=hd :/dev/sdbx Modify to the previous parameters, F10 save and restart
(6) Enter the installation interface, select the language, add the Chinese Pinyin input method, select the installation source to reclaim the disk space, select the Gnome version, connect to broadband or WiFi, enter the installation state, add Root and ordinary users complete the system initialization configuration
1.3 Open port commands under Centos

Open each port of the running software in the firewall to enable other computers to access remotely. If you only need to use it locally, you do not need to open the port.
1. Add the specified port that needs to be opened (8080 is opened here):
firewall-cmd --add-port=8080/tcp --permanent
firewall-cmd --add-port=80/tcp --permanent
firewall- cmd- -add-port=3306/tcp --permanent
firewall-cmd --add-port=15672/tcp --permanent
2. Reload the added port:
firewall-cmd --reload
3. Query whether the specified port is successfully opened:
firewall-cmd --query-port=8080/tcp
4... View all open ports
firewall-cmd --list-ports
1.4 JDK installation
1. Unzip tar -zxvf jdk-8u171-linux-x64.tar.gz;
2. Create a new java folder mkdir /usr/local/java under the directory;
3. Move the decompressed file to the newly added folder mv jdk1.8.0_171/ /usr/local/java;
4. Modify the configuration file and add Environment variables,
add the following content at the end of the file through the command vim /etc/profile:
export JAVA_HOME=/usr/local/java/jdk1.8.0_171
export JRE_HOME= J A V A H O M E / j r e e x p o r t C L A S S P A T H = . : {JAVA_HOME}/jre export CLASSPATH=.: JAVAHOME/jreexportCLASSPATH=.:{JAVA_HOME}/lib: J R E H O M E / l i b : {JRE_HOME}/lib: JREHOME/lib:CLASSPATH
export JAVA_PATH= J A V A H O M E / b i n : {JAVA_HOME}/bin: JAVAHOME/bin:{JRE_HOME}/bin
export PATH= P A T H : PATH: PATH: {JAVA_PATH}
5.source /etc/profile to make the profile file effective immediately. Use javac and java -version to verify.
1.5 Redis installation
1. Install the gcc environment yum install gcc-c++;
2. Decompress: tar -zxvf redis-5.0.3.tar.gz;
3. Enter the decompressed folder, enter make to compile, and after the compilation is complete, we will proceed Installation at a specified location: (installation here, the installation directory we specify is: /usr/local/redis) Enter the command: make PREFIX=/usr/local/redis install (installation here, the installation directory we specify is: /usr/local /redis);
4. Enter the previously unzipped folder, find the redis.conf file and copy it to the installation directory: cp redis.conf /usr/local/redis/bin;
5. Modify the configuration file: cd /usr Redis.conf daemonize yes under /local/redis/bin change no to yes, change the password under requirepass and search for SECURITY. In the code below, set the redis password requirepass luntek20100514;
change protected-mode yes to protected-mode no and
set it as follows Picture:

Figure 1.1 Modify configuration file
Comment out bind 127.0.0.1 (required for remote connection);
6. Enter redis bin directory
cd /usr/local/redis/bin to
open redis command. /redis- server redis.conf
Enter redis command console:. /redis-cli -a luntek20100514;
enter ping for verification, and get pong response, as shown below

Figure 1.2 Enter the bin directory
Note: After entering, enter shutdown to close redis, quit to exit
7. Open the port;
firewall-cmd --add-port=6379/tcp --permanent
firewall-cmd --reload
8. Startup after booting: enter first The redis unzip package utils directory
cd /home/icPlatform/redis/redis-5.0.3/utils/
/home/luntek/download/redis-5.0.3/utils ./install_server.sh If you see the following situation,
you can directly return without modification car
is available for purchase at The Redis to Service Installer
This Script by Will Help you Easily the SET A running up Redis Server

Please select the redis port for this instance: [6379]
Selecting default: 6379
Select the redis configuration file:
Please select the redis config file name [/etc/redis/6379.conf]
input: /usr/local/redis/bin/ redis.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default-
/var/ log/ redis_6379.log Please select the data directory for this instance [/var/lib/redis/6379]
Selected default-/var/lib/redis/6379
Select the startup path of redis:
Please select the redis executable path []
Input: /usr/local/redis/bin/redis-server
as shown in the figure below to indicate successful installation

Type the command:
$ cd /etc/init.d/
$ ls -l

Seeing redis_6379 is successful, as shown in the following figure chkconfig --list
Figure 1.3 chkconfig --list
1.6 ffmpeg installation
1. Upgrade yum;
sudo yum install epel-release -y
sudo yum update -y
2. Install Nux Dextop Yum source;
sudo rpm -v --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/ x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
3. Install FFmpeg and FFmpeg development package;
sudo yum install ffmpeg ffmpeg-devel -y
4. Test;
ffmpeg
5.ffmpeg version 2.8.15 version It is the July 2018 version. If you want the latest version, you can go to the official website to unzip and search for the method, or upgrade the yum resource installation. If it is a decompression installation, you need to configure the ffmpeg path in the code as the installation file path;
using this method to install will be installed in the /usr/share/ffmpeg path by default.
6. Test screenshot, cd /home/icPlatform/
screenshot command
ffmpeg -i test.mov -y -f mjpeg -t 1.001 -s 100*100 a.jpg
as shown in the figure represents success, a.jpg is generated

1.7 RabbitMQ installation The
installation location is /usr/sbin/;
1. Install RabbitMQ and its dependencies;
install the erlang required by RabbitMQ:

rpm -ivh http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el7.centos.x86_64.rpm
install socat:
yum install socat
install rabbitmq:
rpm -ivh http://www. rabbitmq.com/releases/rabbitmq-server/v3.6.15/rabbitmq-server-3.6.15-1.el7.noarch.rpm

/sbin/service rabbitmq-server stop #Close
/sbin/service rabbitmq-server start #Start
/sbin/service rabbitmq-server status #Status
2. View user commands in RabbitMQ;
rabbitmqctl list_users
3. Create user commands;
rabbitmqctl add_user admin admin
4. Give user permission commands;
rabbitmqctl set_permissions -p “/” admin'. ''. ''. '
5. Give user roles commands;
rabbitmqctl set_user_tags admin administrator
6. Open rabbitmq management console commands;
rabbitmq-plugins enable rabbitmq_management
7 .Visit http://192.168.0.173:15672/ to verify (you can also add users to this URL, the default account and password are guest, and you can only log
in locally ); the login page of mq is obtained as shown below Correct
Figure 1.4 mq login page
8. Start automatically after boot;
chkconfig rabbitmq-server on
1.8 MySQL installation The
installation location is /usr/bin/
1. Install the mysql source;
rpm -ivh http://dev.mysql.com//get/mysql80-community-release-el7-3.noarch.rpm
2. Check whether the mysql source is installed successfully;
yum repolist enabled | grep " mysql.
-community. "
3. Modify the vim /etc/yum.repos.d/mysql-community.repo source to change the default installed mysql version, for example, to install version 5.7, change the enabled=1 of the 8.0 source to enabled=0 . Then change the enabled=0 of the 5.7 source to enabled=1, here we install version 5.7;
4. Install MySQL;
yum install mysql-community-common.x86_64 mysql-community-libs.x86_64 mysql-community-client .x86_64 mysql-community-server.x86_64 -y
5. Start MySQL service
systemctl start mysqld
6. Start
systemctl enable mysqld
systemctl daemon-reload
7. Modify root local login password
a) View mysql password
grep'temporary password' /var/ log/mysqld.log
#The password I found out is d7e%dI?-dedu
b)Connect to mysql
mysql -uroot –p, then copy and paste the password
c) Modify the password [Note: the semicolon must be followed;
alter user'root '@' localhost' identified by'Luntek20100514!';
Note: The password must contain uppercase letters, lowercase letters, numbers, special symbols, and the length must be sufficient, otherwise an error will be reported.
8. After entering mysql, add the remote login user
mysql> GRANT ALL PRIVILEGES ON. TO 'root'@'%' IDENTIFIED BY'Luntek20100514!' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
9. Import and export data
a) Export database test from mysql: Run in terminal: mysqldump -h localhost -u root -p test > /home/daochu.sql where localhost is the server name and test is the database name, which can be directly followed by the table name 2) Import daochu.sql into the mysql database: Run in the terminal: mysql -h localhost -u root -p test < /home/daochu.sql --default-character-set=utf8 Among them: --default-character-set=utf8 solves Chinese garbled characters.
b) Create a database, import the luntek_icplatform_test.sql file
1.9 Nginx and fastDFS installation
Reference 1
Reference 2
1. Prepare the files
to be installed Obtain Libfastcommon:
wget https://github.com/happyfish100/libfastcommon/archive/master.zip
Obtain FastFDS:
wget https://github.com/happyfish100/fastdfs/archive/master .zip
Get fastdfs-nginx-module:
wget https://github.com/happyfish100/fastdfs-nginx-module/archive/master.zip
2. Install various dependent software
yum -y install gcc gcc-c++ libstdc+±devel pcre -devel zlib-devel wget make
yum -y groupinstall'Development Tools'
3. Install libfastcommon
unzip libfastcommon-master.zip
mv libfastcommon-master /usr/local/libfastcommon
cd /usr/local/libfastcommon
./make.sh
./make .sh install
4. install fastdfs
unzip fastdfs-master.zip
mv fastdfs-master /usr/local/fastdfs
cd /usr/local/fastdfs
./make.sh
./make.sh install
Open port 22122 and 23000
firewall-cmd --add-port=22122/tcp --permanent
firewall- cmd --add-port=2300/tcp --permanent
reload the added port: firewall-cmd --reload
verification: /etc/fdfs/ There should be four files under .sample
5. Configure tracker and modify base_path (file storage Path) is /opt/fastdfs
mkdir /opt/fastdfs
cp tracker.conf.sample tracker.conf
vim tracker.conf
base_path=/opt/fastdfs
check whether it is started
[root@localhost fdfs]# fdfs_trackerd /etc/fdfs/tracker.conf start
[root@localhost fdfs]# ps -ef|grep tracker.conf Figure 1.5 Configure tracker
[root@localhost fdfs]# netstat -tunlp|grep fdfs
tcp 0 0 0.0.0.0:22122 0.0.0.0:
LISTEN 101689/fdfs_tracker
[root@localhost fdfs]# tail /opt/fastdfs/logs/trackerd.log
INFO-FastDFS v5.12, base_path=/opt/fastdfs...
6. Configure storage
cp storage.conf.sample storage.conf
vim storage.conf
mainly modifies the connection address of basepath, storepath and tracker, as well as the http service port configuration of storage.
group_name=group1 # Group name (the first group is group1, the second group is group2, and so on...)
base_path=/opt/fastdfs # The root directory for storing data and log files
store_path0=/opt/fastdfs # The first storage directory, The second storage directory starts with the name: store_path1=xxx, and the other storage directory names are
deduced by analogy... store_path_count=1 # The number of storage paths must match the number of
store_path tracker_server=192.168.1.120:22122 # tracker server IP and port, yes If there are multiple, add multiple lines.
Check whether it is started
[root@localhost fdfs]# fdfs_storaged /etc/fdfs/storage.conf start
[root@localhost fdfs]# netstat -unltp|grep fdfs

[root@localhost fdfs]# tail /opt/fastdfs/logs/storaged.log
mkdir data path: FA…
mkdir data path: FB…
mkdir data path: FC…
mkdir data path: FD…
mkdir data path: FE…
mkdir data path: FF…
data path: /opt/fastdfs/data, mkdir sub dir done…
Use the following command on any storage node to view the status information of the cluster: fdfsmonitor /etc/fdfs/storage.conf If ipaddr = Active appears, it means The storage server has been registered to the tracker server;
7. Install nginx on the storage and configure the fastdfs-nignx module
unzip fastdfs-nginx-module-master.zip
mv fastdfs-nginx-module-master /usr/local/fastdfs-nginx-module
tar -zxvf nginx-1.16.0.tar.gz
cd nginx-1.16.0/
./configure --prefix=/usr/local/nginx --add-module=/usr/local/fastdfs-nginx-module/src/ #Configure fastdfs-nignx module
without error
make
make install
otherwise you need to install the prompted library (
install on demand according to the prompt) yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel The
following means success
[root@localhost nginx- 1.16.0]# /usr/local/nginx/sbin/nginx -V

8. Configure client
cd /etc/fdfs/
cp client.conf.sample client.conf
vim client.conf
modify the following items
base_path=/opt/fastdfs # data and log file storage root directory
tracker_server=192.168.1.120:22122 # tracker Server IP and port, there are multiple add-by-line (after testing, localhost cannot be used)
http.tracker_server_port=8080 # Server IP and port number
upload a picture for testing, see if it returns the path, return is successful (note whether the port Open)
[root@localhost Picture]# fdfs_upload_file /etc/fdfs/client.conf a.jpg
group1/M00/00/00/wKgBeF0tkduAP5J0AAR5MnVKolg001.jpg

Figure 1.5 Configure client
9. Configure fastdfs-nginx-module and nginx
cd /etc/fdfs/
cp /usr/local/fastdfs-nginx-module/src/mod_fastdfs.conf.
Vim mod_fastdfs.conf
modify the following items
base_path=/opt /fastdfs # Save log directory
tracker_server=192.168.1.120:22122 # Tracker server IP and port, there are multiple add by line
url_have_group_name = true # Is there a group name in the file url
store_path0=/opt/fastdfs # Store path
copy http.conf ,minme.types to /etc/fdfs under
cp /usr/local/fastdfs/conf/http.conf /usr/local/fastdfs/conf/mime.types /etc/fdfs/
10. Anti- leech configuration, modify the copied http.conf
prepares the corresponding anti-hotlinking prompt picture hotlinking.png in advance, and places it in /etc/fdfs/
cd /etc/fdfs/
vim http.conf to modify the file to the following parameters

http.anti_steal.check_token=true
http.anti_steal.token_ttl=240
http.anti_steal.secret_key=FastDFS123Luntek20100514
http.anti_steal.token_check_fail=/etc/fdfs/hotlinking.png
修改nginx.conf,修改内容如下
vim /usr/local/nginx/conf/nginx.conf

server {
    listen       80;
    server_name  luntek.static;
    location ~/group([0-9])/ {
         alias   /opt/fastdfs/data/;
         ngx_fastdfs_module;
    }
    location / {
        root   html;
        index  index.html index.htm;
    }
    }

Start nginx: /usr/local/nginx/sbin/nginx Restart nginx:
/usr/local/nginx/sbin/nginx -s reload Then access the url of the string splicing generated in the above file:
http://192.168.1.120/ group1/M00/00/00/wKgBeF0tkduAP5J0AAR5MnVKolg001.jpg If there is no anti-theft link configuration, the picture should be displayed. After configuration, 400 BadRequest will be displayed.
11. Startup automatically.
Edit the file vim /etc/rc.d/rc.local and add the following:

fastdfs start

/ usr / bin / fdfs_trackerd /etc/fdfs/tracker.conf restart
/ usr / bin / fdfs_storaged /etc/fdfs/storage.conf restart

nginx start

/usr/local/nginx/sbin/nginx
In centos7, the permissions of the /etc/rc.d/rc.local file have been reduced. You need to add executable permissions to the rc.local file chmod +x /etc/rc. d/rc.local


The following is a screenshot of the document in Word, in the form of a picture

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_42910468/article/details/102971148