linux部署項目
2.用putty連接服務器
3.安裝環境
(1)jdk查看JDK是否安裝 java -version
查看jdk安裝包 rpm -qa | grep java
刪除jdk rpm?-e xxx
rpm?-qa?|?grep?jdk?|?xargs?rpm?-e?--nodeps
?rpm?-qa?|?grep?java?|?xargs?rpm?-e?--nodeps
mkdir?/usr/java
?cp?jdk-7u79-linux-x64.gz?/usr/java
tar?xvf?jdk-7u79-linux-x64.gz
設置環境變量
?vi /etc/profile
1.export?JAVA_HOME=/usr/java/jdk1.8.0_171?
2.export?JRE_HOME=$JAVA_HOME/jre??
3.export?PATH=$PATH:$JAVA_HOME/bin??
4.export?CLASSPATH=./:$JAVA_HOME/lib:$JAVA_HOME/jre/lib??
只配置這個即可
export PATH="/usr/local/src/java/bin:$PATH"
使配置文件生效
?source /etc/profile
(2)安裝Mysql,並且啟動
檢查是否安裝MySQL rpm -qa | grep mysql
安裝MySQL yum install -y mysql-server mysql mysql-devel
Mysql首次啟動 service mysqld start
設置新密碼 mysqladmin -u root password
重啟mysql service mysqld restart
進入mysql mysql -u root -p
設置mysql允許遠程連接 GRANT ALL PRIVILEGES ON . TO root@‘%‘ IDENTIFIED BY ‘xxxxxxx‘ WITH GRANT OPTION;
chkconfig mysql on
數據庫的不區別大小寫設置
/etc/my.cnf中的[mysqld]後添加添加lower_case_table_names=1,重啟MYSQL服務
發現中文查詢數據庫有問題,數據庫設置沒配好
修改my.cnf?
- #/etc/my.cnf??
2.???
3.[client]??
4.default-character-set=utf8??
5.???
6.[mysqld]??
7.datadir=/var/lib/mysql??
8.socket=/var/lib/mysql/mysql.sock??
9.user=mysql??
10.#?Disabling?symbolic-links?is?recommended?to?prevent?assorted?security?risks??
11.symbolic-links=0??
12.#default-character-set=utf8??
13.character-set-server=utf8??
14.init_connect=‘SET?NAMES?utf8‘??
15.???
16.[mysql]??
17.no-auto-rehash??
18.default-character-set=utf8??
19.???
20.[mysqld_safe]??
21.log-error=/var/log/mysqld.log??
22.pid-file=/var/run/mysqld/mysqld.pid??
(3)利用putty的pspc上傳文件
下載pscp.exe https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
cmd運行:pscp C:\Users\lenovo\Downloads\Compressed\apache-tomcat-7.0.86.tar.gzroot@xxxx:/
br/>root@xxxx:/
下載tomcat
新建目錄: mkdir /usr/local/tomcat
拷貝tomcat cp apache-tomcat-7.0.86.tar.gz /usr/local/tomcat/
解壓 cd /usr/local/tomcat/
tar -zxvf apache-tomcat-7.0.86.tar.gz
啟動 cd /usr/local/tomcat/apache-tomcat-7.0.86/bin/
./startup.sh
編輯 catalina.sh
JAVA_OPTS="-Xms512m -Xmx1024m -Xss1024K -XX:PermSize=512m -XX:MaxPermSize=1024m"
export TOMCAT_HOME=/usr/local/tomcat/apache-tomcat-7.0.86/
export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-7.0.86/
export JAVA_HOME=/usr/java/jdk1.8.0_171
export PATH=$PATH:$JAVA_HOME/bin?
export CLASSPATH=$JAVA_HOME/lib?
開機自啟動
chkconfig: 345 80 20 # description: start the tomcat deamon # # Source function library . /etc/rc.d/init.d/functions prog=tomcat CATALANA_HOME=/usr/local/tomcat/apache-tomcat-7.0.86/
export CATALINA_HOME case "$1" in start) echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;; stop) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh ;; restart) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh sleep 2 echo echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;; *) echo "Usage: $prog {start|stop|restart}" ;; esac exit 0
chkconfig --add tomcat
chkconfig tomcat on
linux部署項目