安裝JDK、Tomcat、Mysql、Nginx(CentOS 7.4)

  • 上傳軟件包
rz上傳jdk-8u181-linux-x64.tar.gz和apache-tomcat-8.5.32.tar.gz
或者FileZilla Client進行sftp鏈接上傳

安裝JDK、Tomcat、Mysql、Nginx(CentOS 7.4)

  • 解壓JDK到/usr/local/目錄
tar xzvf jdk-8u181-linux-x64.tar.gz -C /usr/local/
  • 查看JAVA是否安裝成功
cd /usr/local/jdk1.8.0_181/bin
[root@fudanwuxi003 bin]# ./java -version 
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mix-ed mode)
  • 配置環境變量
    [root@fudanwuxi003 bin]# vim /etc/profile
    export JAVA_HOME=/usr/local/jdk1.8.0_181
    export CLASSPATH=.:JAVA_HOME/lib
    export PATH=$PATH:$JAVA_HOME/bin
    [root@fudanwuxi003 ~]# source /etc/profile
    [root@fudanwuxi003 ~]# java -version      
    openjdk version "1.8.0_131"
    OpenJDK Runtime Environment (build 1.8.0_131-b12)
    OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
  • 安裝Tomcat
    [root@fudanwuxi003 software]# tar xzvf apache-tomcat-8.5.32.tar.gz
    [root@fudanwuxi003 software]# cd apache-tomcat-8.5.32/
    [root@fudanwuxi003 apache-tomcat-8.5.32]# ll
    總用量 92
    drwxr-x---. 2 root root  4096 8月  20 14:56 bin
    drwx------. 2 root root   238 6月  21 03:53 conf
    drwxr-x---. 2 root root  4096 8月  20 14:56 lib
    -rw-r-----. 1 root root 57092 6月  21 03:53 LICENSE
    drwxr-x---. 2 root root     6 6月  21 03:50 logs
    -rw-r-----. 1 root root  1723 6月  21 03:53 NOTICE
    -rw-r-----. 1 root root  7138 6月  21 03:53 RELEASE-NOTES
    -rw-r-----. 1 root root 16246 6月  21 03:53 RUNNING.txt
    drwxr-x---. 2 root root    30 8月  20 14:56 temp
    drwxr-x---. 7 root root    81 6月  21 03:51 webapps
    drwxr-x---. 2 root root     6 6月  21 03:50 work
    [root@fudanwuxi003 apache-tomcat-8.5.32]# cd bin/
    [root@fudanwuxi003 bin]# pwd
    /root/software/apache-tomcat-8.5.32/bin
    [root@fudanwuxi003 bin]# ./startup.sh 
    Using CATALINA_BASE:   /root/software/apache-tomcat-8.5.32
    Using CATALINA_HOME:   /root/software/apache-tomcat-8.5.32
    Using CATALINA_TMPDIR: /root/software/apache-tomcat-8.5.32/temp
    Using JRE_HOME:        /usr/local/jdk1.8.0_181
    Using CLASSPATH:       /root/software/apache-tomcat-8.5.32/bin/bootstrap.jar:/root/software/apache-tomcat-8.5.32/bin/tomcat-juli.jar
    Tomcat started.
  • 放行默認端口8080,關閉selinux
    [root@fudanwuxi003 bin]# firewall-cmd --permanent --add-port=8080/tcp
    success
    [root@fudanwuxi003 bin]# firewall-cmd --reload 
    success
    [root@fudanwuxi003 bin]# getenforce
    Enforcing
    [root@fudanwuxi003 bin]# setenforce 0
    [root@fudanwuxi003 bin]# getenforce  
    Permissive

    安裝JDK、Tomcat、Mysql、Nginx(CentOS 7.4)

  • 安裝Mysql
    [root@fudanwuxi003 bin]# yum repolist | grep mysql
    [root@fudanwuxi003 bin]# rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
    獲取https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
    警告:/var/tmp/rpm-tmp.m7U7PD: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
    準備中...                          ################################# [100%]
    正在升級/安裝...
    1:mysql80-community-release-el7-1  ################################# [100%]
[root@fudanwuxi003 bin]# yum repolist | grep mysql
mysql-connectors-community/x86_64        MySQL Connectors Community           63
mysql-tools-community/x86_64             MySQL Tools Community                69
mysql80-community/x86_64                 MySQL 8.0 Community Server           33
  • 獲得兩個mysql的yum repo源
[root@fudanwuxi003 yum.repos.d]# pwd
/etc/yum.repos.d
[root@fudanwuxi003 yum.repos.d]# ll
總用量 40
-rw-r--r--. 1 root root 1503 8月   3 05:03 CentOS-Base.repo
-rw-r--r--. 1 root root 1664 8月   3 05:01 CentOS-Base.repo.bak
-rw-r--r--. 1 root root 1309 8月  30 2017 CentOS-CR.repo
-rw-r--r--. 1 root root  649 8月  30 2017 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 8月  30 2017 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 8月  30 2017 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 8月  30 2017 CentOS-Sources.repo
-rw-r--r--. 1 root root 3830 8月  30 2017 CentOS-Vault.repo
-rw-r--r--. 1 root root 1864 2月  22 16:49 mysql-community.repo
-rw-r--r--. 1 root root 1885 2月  22 16:49 mysql-community-source.repo
[root@fudanwuxi003 software]# yum install mysql-community-server
[root@fudanwuxi003 software]# yum install mysql-server
[root@fudanwuxi003 ~]# rpm -qa | grep mysql
mysql-community-server-8.0.12-1.el7.x86_64
mysql80-community-release-el7-1.noarch
mysql-community-libs-8.0.12-1.el7.x86_64
mysql-community-common-8.0.12-1.el7.x86_64
mysql-community-libs-compat-8.0.12-1.el7.x86_64
mysql-community-client-8.0.12-1.el7.x86_64

[root@fudanwuxi003 lib]# systemctl start mysqld
[root@fudanwuxi003 lib]# systemctl enable mysqld
[root@fudanwuxi003 lib]# cat /var/log/mysqld.log |grep password  #查看初始密碼
2018-08-20T11:54:48.607318Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: +goyZ3q8w?!z
[root@fudanwuxi003 lib]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.12

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.  #提示需要先修改密碼

mysql> alter user root@'localhost' identified by 'CentOS7@ajie';  #修改密碼爲CentOS7@ajie
Query OK, 0 rows affected (0.10 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.02 sec)

mysql> 
  • 安裝FTP
  • vsftpd:very secure ftp daemon
[root@fudanwuxi003 ~]# yum install vsftpd
[root@fudanwuxi003 ~]# systemctl restart vsftpd
[root@fudanwuxi003 ~]# netstat -ntpl | grep vsftp
tcp6       0      0 :::21                   :::*                    LISTEN      65571/vsftd        
  • 使用FileZilla進行FTP連接時候報530錯誤

安裝JDK、Tomcat、Mysql、Nginx(CentOS 7.4)

  • 將/etc/vsftpd/目錄下的ftpusers和user_list中的root用戶刪除即可
[root@fudanwuxi003 vsftpd]# pwd
/etc/vsftpd
[root@fudanwuxi003 vsftpd]# cp vsftpd.conf ./vsftpd.conf.bak
[root@fudanwuxi003 vsftpd]# grep -v '#' /etc/vsftpd/vsftpd.conf.bak > vsftpd.conf
[root@fudanwuxi003 vsftpd]# ll
總用量 24
-rw-------. 1 root root  125 8月   3 2017 ftpusers
-rw-------. 1 root root  361 8月   3 2017 user_list
-rw-------. 1 root root  249 8月  21 19:19 vsftpd.conf
-rw-------. 1 root root 5031 8月  21 19:19 vsftpd.conf.bak
-rwxr--r--. 1 root root  338 8月   3 2017 vsftpd_conf_migrate.sh
[root@fudanwuxi003 vsftpd]# cat vsftpd.conf
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

[root@fudanwuxi003 vsftpd]# vim ftpusers   #將root刪除
[root@fudanwuxi003 vsftpd]# vim user_list  #將root刪除
[root@fudanwuxi003 vsftpd]# systemctl restart vsftpd

安裝JDK、Tomcat、Mysql、Nginx(CentOS 7.4)

[root@fudanwuxi003 yum.repos.d]# vim nginx.repo 
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
[root@fudanwuxi003 yum.repos.d]# yum install nginx
[root@fudanwuxi003 yum.repos.d]# systemctl start nginx
[root@fudanwuxi003 yum.repos.d]# systemctl enable nginx

安裝JDK、Tomcat、Mysql、Nginx(CentOS 7.4)

發佈了102 篇原創文章 · 獲贊 53 · 訪問量 8萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章