CentOS project to build springboot operating environment (jdk, tomcat, mysql, redis, mongodb, jenkins, kafka)

After installation is complete network configuration CentOS7

1. Enter the command cd / etc / sysconfig / network-scripts / # enter the network configuration file directory,

2. Enter: vi ifcfg-ens33 edit the configuration file (here is ifcfg-ens33, if not find the beginning of the file ifcfg-ens of, vi is editing commands, enter and then press the "I" for editing, you are finished editing the "Esc "exit operation and press": wq "to save) 

Modify the content as follows: 

TYPE=Ethernet 
PROXY_METHOD=none 
BROWSER_ONLY=no 
BOOTPROTO=none 
DEFROUTE=yes 
IPV4_FAILURE_FATAL=no 
IPV6INIT=yes 
IPV6_AUTOCONF=yes 
IPV6_DEFROUTE=yes 
IPV6_FAILURE_FATAL=no 
IPV6_ADDR_GEN_MODE=stable-privacy 
NAME=ens33 
UUID=be397835-5860-47d9-b96a-57fa3b344a1c 
DEVICE=ens33 
ONBOOT=Yes 
the IPADDR = 192.168.127.201 (# ip address to see here before the start / end of the ip address range) 
the GATEWAY = 192.168.127.2    (see # gateway is arranged before the distribution) 
NETMASK = 255.255.255.0  
the DNS1 = 8.8 .8.8  
IPV6_PEERDNS = yes 
IPV6_PEERROUTES = yes 
IPV6_PRIVACY = NO

Note: The virtual machine settings and host the same subnet to, or can not connect to external networks such as: host ip is 192.168.1.56 then the virtual machine must be set to 192.168.1.2 subnet ip

Resolve domain names need to configure the nameserver: vi /etc/resolv.conf

Add the following to the file:

nameserver 8.8.8.8
nameserver 8.8.4.4

After completion of the ping the external network to

Installation jdk8

1.yum list java * View jdk version

2. Select the specified version to install: yum install java-1.8.0-openjdk-devel-debug.x86_64

3. Check the installation is complete version: java -version

4.java automatically after installation can be viewed in the / usr / lib / jvm directory

 

Tomcat installation

1. Download tomcat: wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.0.52/bin/apache-tomcat-8.0.52.tar.gz

2. 解压 tomcat: tar -zxvf apache-tomcat-9.0.22.tar.gz

3. Enter tomcat directory: cd cd apache-tomcat-9.0.22

4. Start tomcat: sh bin / startup.sh

5. Close tomcat: sh bin / shutdown.sh

6. Configure tomcat environment: vi / etc / profile

  Adding the following at the end of the file: /usr/local/apache-tomcat-9.0.22 is the path of tomcat after decompression

TOMCAT_HOME=/usr/local/apache-tomcat-9.0.22
PATH=$PATH:$TOMCAT_HOME/bin
export TOMCAT_HOME PATH

7. Configure complete refresh: Source / etc / Profile

Install mysql

Need to ensure that the system has libaio dependent 1. Before installing mysql.

yum search libaio 
yum install libaio

2. Download the compressed file mysql database: wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz

3. Download the rpm package: wget -c https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

4. Installation mysql Source:rpm -ivh mysql57-community-release-el7-11.noarch.rpm 

5. Check you can use mysql package: yum list | grep mysql

6. Install mysql, mysql-server mysql version is: yum install mysql-server

7. Start mysql: systemctl start mysqld

Start error: Failed to start mysqld.service: Unit not found

Solve the error:

yum install -y mariadb * 
After reboot mysql service

8. Set the Administrator Password: mysql_secure_installation password

mysql5.7 automatically generates an initial password, the initial password to see: grep 'temporary password' /var/log/mysqld.log

You need to set a password and then change your password security level, otherwise been unable to modify successfully

Modify the security level:

Log mysql service using the initial password: 
mysql > SET  Global validate_password_policy = 0 ; 
mysql > SET  Global validate_password.policy = 0 ; 
mysql > SET  Global validate_password.policy = . 1 ; 
mysql > the USER the ALTER the USER () the IDENTIFIED BY ' 12345678 ' ;

9. The connection to the database: MySQL -uroot- -p

10. Check coding: MySQL> Show Variables like '%% Character';

11. Modify Code:

# 1 . The MY- default the .cnf copied to the / etc / the my.cnf 
CP / usr / Share / DOC / MySQL-Community-Server- 5.6 . 31 is / MY- default the .cnf / etc / the my.cnf 
# 2 . Edit / usr / the my.cnf increase in [client] under (if not add their own)
 default -character- SET = UTF8 
# . 3 . edit / usr / the my.cnf increase in [mysqld] under 
the character_set_server =   UTF8 
# . 4 . restart MySql services 
systemctl restart mysql.service 
# 5 . mysql connection reproduce and view coded as follows: 
mysql -  -uroot -proot
mysql>show variables like '%character%';

12. Set Remote Access:

CREATE USER 'root' @ '% ' IDENTIFIED BY ' your password';
. GRANT ALL ON * * the TO 'root' @ '%';
the ALTER the USER 'root' @ '%' IDENTIFIED the WITH mysql_native_password BY 'your password' ;
FLUSH PRIVILEGES;

13. The open port 3306:

firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

Install redis

1. Download redis archive:wget http://download.redis.io/releases/redis-5.0.5.tar.gz

2. Extract:tar xzf redis-5.0.5.tar.gz

3. After the files are decompressed file to perform make operations:

cd redis-2.8.17
make

4. If you make an error occurs, checking whether the installation c ++ environment: yum -y install gcc-c ++

5. After the installation has finished executing make clean make again performed, and then check the redis-xxx / src directory has no redis-server, and has the redis-cli / usr / local / bin no

If not, put the redis-xxx folder delete, and then unpack once redis archive, cd into the redis-xxx in, make what you can

6.make successful start redis: src / redis-server

Installation jenkins

1. Add jenkins repository: wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo 

2. Run the command: rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

3. Install the latest version jenkins: yum install -y jenkins

4. Start jenkins: service jenkins start

5. modify the default port number: vi / etc / sysconfig / jenkins

Installation zookeeper

1. Download zookeeper: curl -O http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz

2. Extract: tar -zxvf zookeeper-3.4.14.tar.gz

3. To change the file name: mv zookeeper-3.4.14 zookeeper.

4. entry path: cd / zookeeper / conf /   

The backup configuration file cp zoo_sample.cfg zoo.cfg

6. Check modify the configuration file: vi zoo.cfg

tickTime=2000

initLimit=10

syncLimit=5

dataDir=/tmp/zookeeper

clientPort=2181

If you set up a cluster on the same machine: the need to copy the directory to other machines:. Scp -r / usr / local / ZooKeeper root @ 172 17.3. 206 : / usr / local /

7. Start: bin / zkServer.sh Start

8. Check Status: bin / zkServer.sh Status

Installation kafka

1. Download the archive: curl -O http://mirrors.hust.edu.cn/apache/kafka/2.1.1/kafka_2.12-2.1.1.tgz

2. Extract: tar -zxvf kafka_2.12-2.1.1.tgz 

3. To change the file name: mv kafka_2 .11-1 .1 .0 Kafka used to live

4. Check the configuration, stand-alone version does not require changes: vi config / server.properties

5. Open the port, the default port is 9092:

firewall-cmd --zone=public --add-port=9092/tcp --permanent
 
firewall-cmd --reload

6.启动:bin/kafka-server-start.sh -daemon config/server.properties

7. Review the success of start: jps

8. Test:

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
成功输出:Created topic "test".
查看topic:bin/kafka-topics.sh --list --zookeeper 192.168.1.193
发布:./bin/kafka-console-producer.sh --broker-list 192.168.1.193:9092 --topic test
接收:bin/kafka-console-consumer.sh --bootstrap-server 192.168.1.193:9092 --topic test --from-beginning

 

Installation mongodb

Reprinted connection: https://www.cnblogs.com/flying1819/articles/9035408.html

1. The configuration of yum source MongoDB

/etc/yum.repos.d/mongodb-org- vi 3.4 .repo 
# add the following: 
[MongoDB -org- 3.4 ]   
name = MongoDB Repository   
baseurl = HTTPS: // repo.mongodb.org/yum/redhat/$ the releasever / MongoDB-ORG / 3.4 / the x86_64 /   
gpgcheck = . 1   
Enabled = . 1   
gpgkey = HTTPS: // www.mongodb.org/static/pgp/server-3.4.asc 

# here may be modified gpgcheck = 0 , eliminating the need for verification gpg 
[ @ localhost root ~] # yum makecache  

2. Installation mongodb: yum -y install mongodb-org

3. After the successful installation view installation location: whereis mongod

4. Start: systemctl start mongod.service

5. Stop: systemctl stop mongod.service

6. Check status: systemctl status mongod.service

7. turn off the firewall:

systemctl stop firewalld.service # Stop firewall 
systemctl disable firewalld.service # prohibit firewall boot

8. Set mongodb for remote access:

Edit mongod.conf comment bindIp , and restart mongodb. (Phrase configuration represents only use this machine, so the need to comment)

we /etc/mongod.conf

9. Restart: systemctl restart mongod.service

10. Start mongo shell

mongo
show dbs

Guess you like

Origin www.cnblogs.com/sgw812/p/11270459.html