環境: centos 7 64位java
1、配置mysql 5.7
一、下載mysql源安裝包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpmmysql
二、安裝mysql源
yum localinstall mysql57-community-release-el7-8.noarch.rpmnginx
三、安裝mysql
yum install mysql-community-serverc++
四、啓動MySQL服務
systemctl start mysqldsql
五、開機啓動
systemctl enable mysqld
systemctl daemon-reload數據庫
六、進入命令行apache
查看初始密碼
grep 'temporary password' /var/log/mysqld.logvim
登陸數據庫
mysql -uroot -pcentos
修改密碼
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';tomcat
添加遠程登陸用戶 3306端口要開放
grant all privileges on *.* to 'root'@'%' identified by 'MyNewPass4!' with grant option;
退出
EXIT
七、修改配置文件
打開my.conf文件
vim /etc/my.cnf
添加一下數據都最後面
#設置中文編碼
character_set_server=utf8
init_connect='SET NAMES utf8'
#不區分大小寫
lower_case_table_names=1
#select count(*),id from goods 報語法錯誤解決
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
保存好,重啓數據庫
service mysqld restart
2、安裝JAVA環境
一、安裝JDK1.8
yum install java-1.8.0-openjdk-devel.x86_64
二、telnet安裝
yum install telnet.x86_64
三、iptables安裝
yum install iptables-devel.x86_64
建立目錄
mkdir /data/protal
mkdir /data/server
3、安裝tomcat
cd /data/server
一、下載tomcat
wget http://mirror.cc.columbia.edu/pub/software/apache/tomcat/tomcat-8/v8.0.48/bin/apache-tomcat-8.0.48.tar.gz
二、解壓tomcat
tar -zxvf apache-tomcat-8.0.48.tar.gz
三、重命名
mv apache-tomcat-8.0.48 tomcat
四、打開service.xml
vim tomcat/conf/server.xml
五、在<host> 裏面加入
<Context path="" docBase="/data/protal" debug="0" reloadable="true" />
六、解決centos7 tomcat-8啓動慢
yum install rng-tools
systemctl start rngd
4、安裝nginx
一、 gcc 安裝
yum install gcc-c++
二、 PCRE pcre-devel 安裝
yum install -y pcre pcre-devel
三、 zlib 安裝
yum install -y zlib zlib-devel
四、OpenSSL 安裝
yum install -y openssl openssl-devel
五、下載安裝包
wget -c https://nginx.org/download/nginx-1.10.1.tar.gz
六、解壓
tar -zxvf nginx-1.10.1.tar.gz
cd nginx-1.10.1
七、配置時添加ssl模版
./configure --with-http_ssl_module
八、編譯安裝
make
make install
九、替換nginx.conf
cd /usr/local/nginx/conf/
替換nginx.conf 成本身以前寫好的
十、開啓nginx服務
cd /usr/local/nginx/sbin/
./nginx
5、設置別名 一鍵重啓
一、編輯~/.bashrc
vim ~/.bashrc
二、在其加入
alias protal-restart='/data/service/tomcat/bin/shutdown.sh;/data/service/tomcat/bin/startup.sh'
三、source ~/.bashrc
6、雲盤的掛載
http://blog.csdn.net/laughing_cui/article/details/52034298
加上所替換的NGINX.CONF配置文件:
連接:https://pan.baidu.com/s/1o9NNIIY 密碼:cr85