一、安裝CentOS7java
此處省略。
linux
二、配置服務器IPnginx
#一、編輯網卡文件shell
[root@localhost ~]# cd /etc/sysconfig/network-scripts/[root@localhost network-scripts]# vi ifcfg-eno16777736
#二、網卡配置文件apache
HWADDR=00:0C:29:18:30:F6 TYPE=Ethernet BOOTPROTO=static #設置爲靜態 DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=eno16777736 UUID=28b08726-b112-40d5-b636-020920a663ba ONBOOT=yes #設置爲開機啓動 IPADDR=192.168.1.110 #IP地址 DNS1=114.114.114.114 #DNS GATEWAY=192.168.1.253 #網關 NETMASK=255.255.255.0 #子網掩碼
#三、保存設置並重啓網絡服務tomcat
:wq [root@localhost network-scripts]# service network restart Restarting network (via systemctl): [ OK ]
#四、查看IP地址bash
[root@localhost network-scripts]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:18:30:f6 brd ff:ff:ff:ff:ff:ff inet 192.168.1.110/24 brd 192.168.1.255 scope global eno16777736 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe18:30f6/64 scope link valid_lft forever preferred_lft forever
三、添加/刪除用戶服務器
#一、添加用戶網絡
[root@localhost home]# adduser rogue
#二、設置用戶密碼oop
passwd rogue
#三、刪除用戶
[root@localhost home]# userdel rogue
#四、刪除用戶以及用戶目錄
[root@localhost home]# userdel -f rogue
#五、切換到用戶
[root@localhost home]# su rogue[rogue@localhost home]$
四、安裝JDK
#一、下載 jdk-7u75-linux-x64.tar.gz
#二、在我的文件夾下建立dev目錄
[rogue@localhost download]$ cd /home/rogue [rogue@localhost ~]$ mkdir dev
#三、解壓jdk-7u75-linux-x64.tar.gz
[rogue@localhost download]$ tar -zxvf jdk-7u75-linux-x64.tar.gz -C /home/rogue/dev
#四、配置環境變量
編輯 .bash_profile文件
[rogue@localhost home]$ cd rogue [rogue@localhost ~]$ ls -a . .. .bash_logout .bash_profile .bashrc dev [rogue@localhost ~]$ vi .bash_profile
添加JAVA_HOME、CLASSPATH、PATH等變量
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/.local/bin:$HOME/bin export PATH export JAVA_HOME=/home/rogue/dev/jdk1.7.0_75 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin
保存並退出
:wq
#五、使配置文件生效
[rogue@localhost ~]$ source .bash_profile
#六、測試安裝狀況,以下表示安裝成功。
[rogue@localhost ~]$ java -version java version "1.7.0_75" Java(TM) SE Runtime Environment (build 1.7.0_75-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
五、安裝Tomcat
#一、下載apache-tomcat-7.0.59.tar.gz
#二、解壓apache-tomcat-7.0.59.tar.gz
[rogue@localhost download]$ tar -zxvf apache-tomcat-7.0.59.tar.gz -C /home/rogue/dev/tomcat
六、開啓/關閉防火牆
#一、開啓防火牆
[root@localhost bin]# systemctl start firewalld.service
#二、關閉防火牆
[root@localhost bin]# systemctl stop firewalld.service
#三、禁止firewall開機啓動
[root@localhost bin]# systemctl disable firewalld.service rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service' rm '/etc/systemd/system/basic.target.wants/firewalld.service'
#四、查看防火牆狀態
[root@localhost nginx]# firewall-cmd --state