linux環境centos7 配置java環境

1.安裝jdk1.8

官網下載地址:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

選擇操作系統和對應的文件進行下載

直接下載tar.gz版本,不用安裝,直接解壓就可以

[圖片上傳失敗...(image-8d24a5-1560867798014)]下載完以后,解壓到/usr/local目錄

[root@bogon hcb]# tar zxvf jdk-8u211-linux-x64.tar.gz -C /usr/local

2.安裝tomcat

官方網內打不開了。 直接通過鏡像下載

https://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.5.42/bin/

[圖片上傳失敗...(image-f77ea-1560867798014)]

同樣解壓安裝就可以

tar zxvf apache-tomcat-8.5.42.tar.gz -C /usr/local
  1. 建立一個tomcat的快捷方式
ln -s apache-tomcat-8.5.42 tomcat
  1. 啟動:
[root@bogon tomcat]# pwd
/usr/local/tomcat
[root@bogon tomcat]# ./bin/startup.sh 

3.添加防火墻例外,并重啟

[root@bogon tomcat]# firewall-cmd --zone=public --add-port=8080/tcp --permanent
success
[root@bogon tomcat]# firewall-cmd --reload

4.物理機輸入ip地址測試

image

3.安裝Mysql

因為centos 7 默認源mariadb替換了mysql

所以要把mysql先添加到源上

  1. 下載mysql源安裝包

    如果 Centos 系統版本大于7,默認源使用 mariadb 替換掉了 MySQL, 如果仍要安裝 MySQL,只能采取源碼安裝。
    
  2. 安裝mysql源

    yum localinstall mysql57-community-release-el7-8.noarch.rpm
    
  3. 檢查mysql的源是否安裝成功

    yum repolist enabled | grep “mysql.-community.”
    
  4. 安裝Mysql

    yum install mysql-community-server
    
  5. 啟動Mysql

    systemctl start mysqld
    
  6. 查看默認的root密碼

    [root@bogon hcb]# grep 'temporary password' /var/log/mysqld.log 
    2019-06-18T05:11:11.189330Z 1 [Note] A temporary password is generated for root@localhost: k(VPiD:wg7lh
    
  7. 修改root密碼

    提示;ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    這是表示 你的新密碼安全強度不夠。增強密碼強度就可以,注意區分大小寫

    [root@bogon hcb]# mysql -u root -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 3
    Server version: 5.7.26
    
    Copyright (c) 2000, 2019, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'xdafdafdsaf2123231';
      
    
  8. 如何關閉密碼策略

    vi /etc/my.cnf 中最后添加 下面一行。表示 關閉密碼策略
    validate_password=off
    
  9. 重啟mysql后生效

    systemctl restart mysqld
    
  10. mysql設定開機啟動

    [root@bogon hcb]# systemctl enable mysqld
    [root@bogon hcb]# systemctl daemon-reload
    

    systemctl 是centos7中用于控制系統服務的。以 前版本是service xxx start|stop
    daemon 是linux的守護進程 ,用于后臺長期不間斷運行的程序

參考:https://blog.csdn.net/yuanlaijike/article/details/78877830

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。