標籤:lis attr unp exec compress firewall rda usr res
首先是前戲,推薦一個遠程工具Xshell和Xftp搭配使用,以下是Xshell的官網
http://www.netsarang.com/products/xsh_overview.html
1.openjdk
How to download and install prebuilt OpenJDK packages
JDK 8
Debian, Ubuntu, etc.
On the command line, type:
$ sudo apt-get install openjdk-8-jre
The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk package.
Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
On the command line, type:
$ su -c “yum install java-1.8.0-openjdk”
The java-1.8.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.8.0-openjdk-devel package.
以上說了不同系統的安裝方式,還指出命令只是安裝了JRE,如果你需要開發應用程式,還需要另外安裝(已經用加粗標識),想安裝其它版本詳情看openjdk官網介紹
http://openjdk.java.net/install/
[root@VM_207_229_centos ~]# java -versionopenjdk version "1.8.0_71"OpenJDK Runtime Environment (build 1.8.0_71-b15)OpenJDK 64-Bit Server VM (build 25.71-b15, mixed mode)
2.tomcat
# cd /usr/local# wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz# tar xzf apache-tomcat-8.0.36.tar.gz# mv apache-tomcat-8.0.36 tomcat# lsapache-tomcat-8.0.36.tar.gz etc include lib64 logs sa share tomcat bin games lib libexec qcloud sbin src
個人習慣把tomcat放在/user/local下,下載後解壓,再更名為tomcat
想要其它版本的話……在以下地址找好路徑下載
https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/
修改設定檔conf/server.xml改為監聽80連接埠,預設編碼utf-8,並開啟gzip壓縮
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" executor="tomcatThreadPool" URIEncoding="utf-8" compression="on" compressionMinSize="50" noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" /> <!-- A "Connector" using the shared thread pool-->
啟動tomcat,在瀏覽器輸入ip地址訪問,看到tomcat小貓頁面就行了。CentOS7開放80連接埠,Centos 7使用firewalld代替了原來的iptables。
<!-- 啟動防火牆 --># systemctl start firewalld<!-- 開啟80連接埠,出現success表明添加成功 --># firewall-cmd --zone=public --add-port=80/tcp --permanent<!-- 重啟防火牆 --># systemctl restart firewalld.service<!-- 檢查連接埠 --># firewall-cmd --permanent --zone=public --list-ports<!-- 自啟動防火牆 -->#systemctl enable firewalld
還有更改預設訪問地址,不想見到tomcat小貓(此步驟看個人需要)
<Engine name="Catalina" defaultHost="www.caihongwen.cn"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="www.caihongwen.cn" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Context docBase="blog" path="" debug="0" reloadable="true"/> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> </Engine>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
請在意Host之間添加了一段代碼
<Context docBase="blog" path="" debug="0" reloadable="true"/>
這個blog是放在webapps的項目war包名,通過ip或網域名稱直接進入部落格,不會出現tomcat小貓管理頁面,第一次啟動tomcat稍慢,新增加的war包需要重啟一次才能起效。還有一個要點是對外開啟80連接埠。
3.mysql
使用RPM包進行安裝,這種安裝進程會自動完成系統的相關配置,比較方便。
另外有.tar.gz的壓縮檔安裝方式,推薦一個部落格的介紹。
http://blog.csdn.net/superchanon/article/details/8546254/
卸載原有MySQL或者Mariadb安裝程式
1、CentOs7版本預設情況下安裝了mariadb-libs,必須先卸載才可以繼續安裝MySql。
a) 尋找以前是否安裝mariadb-libs
# rpm -qa | grep -i mariadb-libs
b)卸載已經安裝的mariadb-libs
# yum remove mariadb-libs-5.5.44-2.el7.centos.x86_64
2、尋找以前是否安裝MySQL
# rpm -qa | grep -i mysql
有的話,也刪除
安裝MySQL
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm# rpm -ivh mysql-community-release-el7-5.noarch.rpm# yum install mysql-community-server
成功安裝之後重啟mysql服務
# service mysqld restart
初次安裝mysql是root賬戶是沒有密碼的,設定密碼的方法
# mysql -urootmysql> set password for ‘root‘@‘localhost‘ = password(‘mypasswd‘);
遠程授權串連mysql
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘mypasswd‘ WITH GRANT OPTION;FLUSH PRIVILEGES;
修改mysql預設編碼
# vim /etc/my.cnf
作出以下修改
[client]default-character-set=utf8[mysqld]character_set_server=utf8
然後重啟mysql
# service mysqld restart# mysql -uroot -pmysql> show variables like ‘character%‘;+--------------------------+----------------------------+| Variable_name | Value |+--------------------------+----------------------------+| character_set_client | utf8 || character_set_connection | utf8 || character_set_database | utf8 || character_set_filesystem | binary || character_set_results | utf8 || character_set_server | utf8 || character_set_system | utf8 || character_sets_dir | /usr/share/mysql/charsets/ |+--------------------------+----------------------------+8 rows in set (0.00 sec)mysql> show variables like ‘collation%‘;+----------------------+-----------------+| Variable_name | Value |+----------------------+-----------------+| collation_connection | utf8_general_ci || collation_database | utf8_general_ci || collation_server | utf8_general_ci |+----------------------+-----------------+3 rows in set (0.00 sec)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
安裝mysql-jdbc驅動
# yum install mysql-connector-java
完工!!!
遠端連線mysql,如果串連不上的話,可能是沒開放3306連接埠。
最後,分享一個mysql遠端管理神器navicat,你懂的
http://pan.baidu.com/s/1mh87vGc
CentOS7安裝openjdk、tomcat和mysql流程介紹