centos虛擬機 服務器搭建
阿新 • • 發佈:2018-01-03
配置 ria font pre path ict grep star tor
導入壓縮包
$ scp /c/Users/Administrator/Desktop/apache-tomcat-8.0.46.tar.gz root@192.168.11 6.129:/opt root@192.168.116.129‘s password: apache-tomcat-8.0.46.tar.gz
配置SQL
systemctl start mariadb systemctl enable mariadb mysql_secure_installation mysql -uroot -p systemctl stop firewalld 關閉防火墻 setenfore 0 mariadb systemctl restart mariadb 重啟 mysql-uroot -p 進入數據庫
輸入---------
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;
FLUSH PRIVILEGES;
-------然後打開SQLyog
退出數據庫
[root@localhost ~]# ls anaconda-ks.cfg Desktop Documents Downloads Music Pictures Public Templates Videos [root@localhost ~]# cd /opt [root@localhost opt]# ls apache-tomcat-8.0.46.tar.gz jdk1.8.0_60.tar.gz rh [root@localhost opt]# tar -xvf apache-tomcat-8.0.46.tar.gz [root@localhost opt]# tar -xvf jdk1.8.0_60.tar.gz [root@localhost opt]# rm -rf apache-tomcat-8.0.46.tar.gz 刪除壓縮包 [root@localhost opt]# rm -rf jdk1.8.0_60.tar.gz [root@localhost opt]# ls apache-tomcat-8.0.46 jdk1.8.0_60 rh [root@localhost opt]# cp -r apache-tomcat-8.0.46/ apache-tomcat-8.0.46-2 復制Tomcat [root@localhost opt]# ls apache-tomcat-8.0.46 apache-tomcat-8.0.46-2 jdk1.8.0_60 rh [root@localhost opt]# cd [root@localhost ~]# pwd /root [root@localhost ~]# ll -a total 52 dr-xr-x---. 14 root root 4096 Dec 21 22:54 . dr-xr-xr-x. 17 root root 4096 Dec 7 03:58 .. -rw-------. 1 root root 2748 Dec 7 03:59 anaconda-ks.cfg -rw-r--r--. 1 root root 18 Dec 28 2013 .bash_logout -rw-r--r--. 1 root root 176 Dec 28 2013 .bash_profile -rw-r--r--. 1 root root 176 Dec 28 2013 .bashrc drwx------. 10 root root 4096 Dec 21 18:38 .cache drwxr-xr-x. 15 root root 4096 Dec 21 18:09 .config -rw-r--r--. 1 root root 100 Dec 28 2013 .cshrc 2/4 drwxr-xr-x. 2 root root 6 Dec 21 18:08 Desktop drwxr-xr-x. 2 root root 6 Dec 21 18:08 Documents drwxr-xr-x. 2 root root 6 Dec 21 18:08 Downloads -rw-------. 1 root root 16 Dec 21 18:08 .esd_auth -rw-------. 1 root root 624 Dec 21 18:38 .ICEauthority drwx------. 3 root root 18 Dec 21 18:08 .local drwxr-xr-x. 2 root root 6 Dec 21 18:08 Music -rw-------. 1 root root 102 Dec 21 22:54 .mysql_history drwxr-xr-x. 2 root root 6 Dec 21 18:08 Pictures drwxr-----. 3 root root 18 Dec 21 19:01 .pki drwxr-xr-x. 2 root root 6 Dec 21 18:08 Public -rw-r--r--. 1 root root 129 Dec 28 2013 .tcshrc drwxr-xr-x. 2 root root 6 Dec 21 18:08 Templates drwxr-xr-x. 2 root root 6 Dec 21 18:08 Videos [root@localhost ~]# ls -a . .bash_logout .cache Desktop .esd_auth Music .pki Templates .. .bash_profile .config Documents .ICEauthority .mysql_history Public Videos anaconda-ks.cfg .bashrc .cshrc Downloads .local Pictures .tcshrc [root@localhost ~]# vim .bashrc export PATH=$PATH:$JAVA_HOME/bin export JAVA_HOME=/OPT/JDK1.8.0_60 設置環境變量 [root@localhost ~]# java -version openjdk version "1.8.0_65" OpenJDK Runtime Environment (build 1.8.0_65-b17) OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode) [root@localhost ~]# source .bashrc [root@localhost ~]# java -version openjdk version "1.8.0_65" OpenJDK Runtime Environment (build 1.8.0_65-b17) OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode) [root@localhost ~]# echo "123123" 123123 [root@localhost ~]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/opt/jdk1.8.0_60/bin [root@localhost ~]# cd /opt [root@localhost opt]# cd /apache-tomcat-8.0.46/bin -bash: cd: /apache-tomcat-8.0.46/bin: No such file or directory [root@localhost opt]# cd [root@localhost ~]# cd /opt/apache-tomcat-8.0.46/bin [root@localhost bin]# cd .. [root@localhost apache-tomcat-8.0.46]# cd conf/ [root@localhost conf]# ls catalina.policy context.xml server.xml tomcat-users.xsd catalina.properties logging.properties tomcat-users.xml web.xml [root@localhost conf]# cat web.xml 查看文件內容 [root@localhost conf]# ls catalina.policy context.xml server.xml tomcat-users.xsd catalina.properties logging.properties tomcat-users.xml web.xml [root@localhost conf]# cd .. [root@localhost apache-tomcat-8.0.46]# exit logout There are stopped jobs. [root@localhost apache-tomcat-8.0.46]# cd [root@localhost ~]# cd /opt/apache-tomcat-8.0.46/bin/conf -bash: cd: /opt/apache-tomcat-8.0.46/bin/conf: No such file or directory [root@localhost ~]# cd /opt/apache-tomcat-8.0.46/bin [root@localhost bin]# cd /conf -bash: cd: /conf: No such file or directory [root@localhost bin]# cd conf -bash: cd: conf: No such file or directory 3/4 [root@localhost bin]# cd conf/ -bash: cd: conf/: No such file or directory [root@localhost bin]# cd .. [root@localhost apache-tomcat-8.0.46]# cd conf/ [root@localhost conf]# cd /opt/ [root@localhost opt]# apache-tomcat-8.0.46/bin/startup.sh Using CATALINA_BASE: /opt/apache-tomcat-8.0.46 Using CATALINA_HOME: /opt/apache-tomcat-8.0.46 Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.46/temp Using JRE_HOME: /opt/jdk1.8.0_60 Using CLASSPATH: /opt/apache-tomcat-8.0.46/bin/bootstrap.jar:/opt/apache-tomcat-8.0.46/bin/tomcat-juli.jar Tomcat started. [root@localhost opt]# cd apache-tomcat-8.0.46/webapps/ [root@localhost webapps]# ls docs examples host-manager manager ROOT [root@localhost webapps]# ls docs examples GM_BMI.war host-manager manager ROOT [root@localhost webapps]# jar -xvf GM_BMI.war [root@localhost webapps]# ls css examples GM_BMI.war img js META-INF WEB-INF docs GM_BMI host-manager index.html manager ROOT [root@localhost webapps]# cd [root@localhost ~]# cd /opt/apache-tomcat-8.0.46/bin [root@localhost bin]# which java /usr/bin/java [root@localhost bin]# which ll alias ll=‘ls -l --color=auto‘ /usr/bin/ls [root@localhost bin]# ps aux | grep tomcat root 40172 0.3 12.6 2302004 126528 pts/0 Sl 23:16 0:10 /opt/jdk1.8.0_60/bin/java -Djava.util.logging.config.file=/ opt/apache-tomcat-8.0.46/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager - Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Djava.endorsed.dirs=/ opt/apache-tomcat-8.0.46/endorsed -classpath /opt/apache-tomcat-8.0.46/bin/bootstrap.jar:/opt/apache-tomcat-8.0.46/bin/ tomcat-juli.jar -Dcatalina.base=/opt/apache-tomcat-8.0.46 -Dcatalina.home=/opt/apache-tomcat-8.0.46 -Djava.io.tmpdir=/ opt/apache-tomcat-8.0.46/temp org.apache.catalina.startup.Bootstrap start root 40706 0.0 0.0 112644 952 pts/0 R+ 23:59 0:00 grep --color=auto tomcat [root@localhost bin]# lsof -i:8080 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 40172 root 47u IPv6 103623 0t0 TCP *:webcache (LISTEN) [root@localhost bin]# lsof -i:80 [root@localhost bin]# lsof -i:3306 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 39580 mysql 14u IPv4 97555 0t0 TCP *:mysql (LISTEN) mysqld 39580 mysql 35u IPv4 97794 0t0 TCP 192.168.116.129:mysql->192.168.116.1:e-design-web (ESTABLISHED) mysqld 39580 mysql 36u IPv4 97795 0t0 TCP 192.168.116.129:mysql->192.168.116.1:6704 (ESTABLISHED) [root@localhost bin]# lsof -i:80 [root@localhost bin]# cd [root@localhost ~]# cd /opt/apache-tomcat-8.0.46-2/ [root@localhost apache-tomcat-8.0.46-2]# vim conf/server.xml 8080----->8080 8009----->8010 8443----->8444 8005----->8006 [root@localhost apache-tomcat-8.0.46-2]# ls bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work [root@localhost apache-tomcat-8.0.46-2]# ./bin/startup.sh Using CATALINA_BASE: /opt/apache-tomcat-8.0.46-2 Using CATALINA_HOME: /opt/apache-tomcat-8.0.46-2 Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.46-2/temp Using JRE_HOME: /opt/jdk1.8.0_60 Using CLASSPATH: /opt/apache-tomcat-8.0.46-2/bin/bootstrap.jar:/opt/apache-tomcat-8.0.46-2/bin/tomcat-juli.jar Tomcat started. 4/4 [root@localhost apache-tomcat-8.0.46-2]# cd /opt [root@localhost opt]# rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm 建立nginx的yum倉庫 [root@localhost opt]# rm -f /var/run/yum.pid /*解決yum被占進程運行問題*/ [root@localhost opt]# yum install -y nginx 下載並安裝nginx [root@localhost opt]# systemctl start nginx 啟動nginx服務
centos虛擬機 服務器搭建