一、安裝jdk

1. 登入Linux,切換到root使用者

su root #獲取root使用者許可權,當前工作目錄不變(需要root密碼)
或
sudo -i #不需要root密碼直接切換成root(需要當前使用者密碼)

2. 在usr/local目錄下建立java安裝目錄

mkdir -p /usr/local/java

3.上傳安裝檔案到linux
解壓tar.gz
首先需要安裝依賴:

tar -zxvf jdk-8u181-linux-x64.tar.gz -C /usr/local/java

4.配置環境變數:

vim /etc/profile

#set java environment
JAVA_HOME=/usr/local/java/jdk1.7.0_71
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH

重新載入配置檔案:【否則環境變數不會重新執行】
source /etc/profile

二、安裝MySQL

[[email protected] ~]# wget 'https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm'

2、將源裡面的資訊讀取出來

[[email protected] ~]# rpm -Uvh mysql57-community-release-el7-11.noarch.rpm

3、安裝mysql
方法一:直接安裝最新的伺服器版本

[[email protected] ~]# yum -y install mysql-community-server

方法二:安裝下載包

[[email protected] ~]# ls
mysql57-community-release-el7-11.noarch.rpm
[[email protected] ~]# yum -y install mysql57-community-release-el7-11.noarch.rpm

4、啟動mysql

[[email protected] ~]# service mysqld start

5、檢視是否已經啟動了(如下就是已經啟動了)

[[email protected] ~]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 一 2018-03-26 17:03:05 CST; 50s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 10570 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 10497 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 10575 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─10575 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/my...

3月 26 17:02:57 iz2ze2llim71y07x3numlbz systemd[1]: Starting MySQL Server...
3月 26 17:03:05 iz2ze2llim71y07x3numlbz systemd[1]: Started MySQL Server.

6、檢視初始密碼

[[email protected] ~]# grep "password" /var/log/mysqld.log

7、修改密碼

[[email protected] ~]# mysql -uroot -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21

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> 

8、修改密碼設定規則

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

9、設定密碼

mysql> SET PASSWORD FOR 'root'@'localhost' = 'hello123456';
Query OK, 0 rows affected (0.00 sec)

10、接下來就可以遠端連線了

三、安裝Tomcat

1.下載tomcat
官方下載地址:tomcat8官方下載地址
2.安裝tomcat
安裝好jdk後,同時也下載好tomcat安裝包,使用ftp功能將安裝包放入指定的目錄下
(1)建立目錄

mkdir -p /usr/local/tomcat

(2)解壓tomcat安裝包

tar -zxvf apache-tomcat-8.0.53.tar.gz  -C /usr/local/tomcat

(3)刪除tomcat安裝包(如果需要)

rm -rf apache-tomcat-8.0.53.tar.gz

(4)修改檔名(解壓後的檔名過長,可以考慮修改短)

mv  apache-tomcat-8.0.53 tomcat8

(5)進入tomcat的目錄(根據自己的安裝目錄來)

cd /usr/local/tomcat/tomcat8/bin

(6)檢視tomcat的執行狀態

ps -ef |grep tomcat

(7)啟動tomcat

./startup.sh

(8)關閉tomcat

./shutdown.sh

(9)訪問伺服器ip地址
在這裡插入圖片描述