码迷,mamicode.com
首页 > 系统相关 > 详细

linux部署项目

时间:2018-05-04 20:22:03      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:linux部署

1.买云主机(亿速云xxx)
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
#set java environment

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 list | 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?

  1. #/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.gzbr/>root@xxxx:/
(4)安装tomcat
下载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部署项目

标签:linux部署

原文地址:http://blog.51cto.com/10913595/2112853

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!