jdk,tomcat,mysql的安裝
一、虛擬機器的clone
1. clone的步驟
+ 選擇要clone虛擬機器,右鍵--》管理--》clone對話方塊,點選開啟
+ 進入“歡迎使用clone虛擬機器嚮導” 點選 下一步
+ clone 虛擬機器當前狀態或者從備份的快照中clone,然後點選“下一步“
+ 建立完整clone,點選”下一步”
+ 給clone出來的虛擬機器命名,並指定儲存空間即可,點選“完成”
2. clone之後eth0網絡卡不見的問題解決:
參考:<https://blog.csdn.net/Noodlewar/article/details/73797768>
二、檢視後臺服務的命令
service –status-all
chkconfig:檢視服務啟動級別
可以通過vi /etc/inittab檢視
[root@localhost apps]# vi /etc/inittab
結果如下:
Default runlevel. The runlevels used are:
0 - halt (Do NOT set initdefault to this)
1 - Single user mode
2 - Multiuser, without NFS (The same as 3, if you do not have networking)
3 - Full multiuser mode
4 - unused
5 - X11
6 - reboot (Do NOT set initdefault to this)
id:3:initdefault:
[root@localhost ~]# chkconfig iptables --list
iptables 0:關閉 1:關閉 2:啟用 3:啟用 4:啟用 5:啟用 6:關閉
[root@localhost ~]# chkconfig iptables off
[root@localhost ~]# chkconfig iptables --list
iptables 0 :關閉 1:關閉 2:關閉 3:關閉 4:關閉 5:關閉 6:關閉
[root@localhost ~]# chkconfig iptables on
[root@localhost ~]# chkconfig iptables --list
iptables 0:關閉 1:關閉 2:啟用 3:啟用 4:啟用 5:啟用 6:關閉
三、jdk的安裝
安裝jdk(wget,或者通過工具filezilla將windows的檔案上傳)
- 可以使用儒興華工具,filezilla
- 可以使用sftp工具(SecureCRT工具 alt+t),
- lrzsz 通過rz命令
解壓jdk
壓縮命令
[root@localhost software]# tar -cvf aaa.tar.gz jdk
解壓縮
[root@localhost software]# tar -zxvf aaa.tar.gz
配置環境變數
- 找到jdk的bin目錄的路徑
[root@localhost bin]# pwd /root/apps/jdk-10/bin
vim /etc/profile
export JAVA_HOME=/root/apps/jdk-10 expott PATH=$PATH:$JAVA_HOME/bin
重新載入檔案
[root@localhost bin]# source /etc/profile
四、mysql的安裝(安裝rpm包軟體)
上傳rpm安裝包
mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar mysql-community-client-5.7.21-1.el6.x86_64.rpm mysql-community-common-5.7.21-1.el6.x86_64.rpm mysql-community-devel-5.7.21-1.el6.x86_64.rpm mysql-community-embedded-5.7.21-1.el6.x86_64.rpm mysql-community-embedded-devel-5.7.21-1.el6.x86_64.rpm mysql-community-libs-5.7.21-1.el6.x86_64.rpm mysql-community-libs-compat-5.7.21-1.el6.x86_64.rpm mysql-community-server-5.7.21-1.el6.x86_64.rpm mysql-community-test-5.7.21-1.el6.x86_64.rpm
安裝順序
rpm -ivh mysql-community-common-5.7.12-1.el6.x86_64.rpm rpm -ivh mysql-community-libs-5.7.12-1.el6.x86_64.rpm rpm -ivh mysql-community-client-5.7.12-1.el6.x86_64.rpm rpm -ivh mysql-community-server-5.7.12-1.el6.x86_64.rpm rpm -ivh mysql-community-devel-5.7.12-1.el6.x86_64.rpm
安裝perl依賴
- rpm -ivh perl* (安裝會提示有包衝突,解決: rpm -e 衝突包名 –nodeps)
安裝common
[root@localhost apps]# rpm -ivh mysql-community-common-5.7.21-1.el6.x86_64.rpm
報錯: 安裝包衝突,之前安裝的有mysql
file /usr/share/mysql/czech/errmsg.sys from install of mysql-community-common-5.7.21-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-8.el6_8.x86_64
解除安裝已經安裝的mysql
[root@localhost apps]# yum -y remove mysql-libs-5.1.73-8.el6_8.x86_64
再次安裝common,即可!
安裝libs
[root@localhost apps]# rpm -ivh mysql-community-libs-5.7.21-1.el6.x86_64.rpm warning: mysql-community-libs-5.7.21-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-libs ########################################### [100%]
安裝client
[root@localhost apps]# rpm -ivh mysql-community-client-5.7.21-1.el6.x86_64.rpm warning: mysql-community-client-5.7.21-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-client ########################################### [100%]
安裝server
[root@localhost apps]# rpm -ivh mysql-community-server-5.7.21-1.el6.x86_64.rpm warning: mysql-community-server-5.7.21-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-server ########################################### [100%]
shell
[[email protected] apps]# rpm -ivh mysql-community-server-5.7.21-1.el6.x86_64.rpm
warning: mysql-community-server-5.7.21-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.21-1.el6.x86_64
libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-5.7.21-1.el6.x86_64
libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-5.7.21-1.el6.x86_64
mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.21-1.el6.x86_64
mysql-community-common(x86-64) = 5.7.21-1.el6 is needed by mysql-community-server-5.7.21-1.el6.x86_64
安裝出現了問題:
libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.21-1.el6.x86_64
缺少依賴包,通過yum安裝即可
shell
[[email protected] apps]# yum install libnuma*
安裝devel
[root@localhost apps]# rpm -ivh mysql-community-devel-5.7.21-1.el6.x86_64.rpm warning: mysql-community-devel-5.7.21-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-devel ########################################### [100%]
啟動mysql服務
[[email protected] apps]# service mysqld start 初始化 MySQL 資料庫: [確定] 正在啟動 mysqld: [確定]
修改管理員密碼
檢視初始管理員密碼,下面的命令適用於 RHEL, Oracle Linux, CentOS, and Fedora 平臺:
[root@localhost apps]# grep 'temporary password' /var/log/mysqld.log 2018-03-28T15:13:47.745123Z 1 [Note] A temporary password is generated for root@localhost: ?cpDoUgi;7c!
登陸成功(參考第10步)後修改密碼:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123'; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
密碼太簡單,報錯:Your password does not satisfy the current policy requirements
密碼必須包含大寫字母小寫字母數字和符號
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'; Query OK, 0 rows affected (0.00 sec)
測試資料庫是否安裝成功
[[email protected] apps]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 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禁止遠端登陸訪問,如何解決?
該表法(親測有效)
mysql> use mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed
mysql> update user set host='%' where user = 'root'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host,user from user; +-----------+---------------+ | host | user | +-----------+---------------+ | % | root | | localhost | mysql.session | | localhost | mysql.sys | +-----------+---------------+ 3 rows in set (0.00 sec)
- 授權法(沒有測試)
2. 授權法。 例如,你想myuser使用mypassword從任何主機連線到mysql伺服器的話。 GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; FLUSH PRIVILEGES; 如果你想允許使用者myuser從ip為192.168.1.6的主機連線到mysql伺服器,並使用mypassword作為密碼 GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; FLUSH PRIVILEGES; 如果你想允許使用者myuser從ip為192.168.1.6的主機連線到mysql伺服器的dk資料庫,並使用mypassword作為密碼 GRANT ALL PRIVILEGES ON dk.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; FLUSH PRIVILEGES; 我用的第一個方法,剛開始發現不行,在網上查了一下,少執行一個語句 mysql>FLUSH RIVILEGES 使修改生效.就可以了