SSH默认端口JDK64安装Tomcat安装 tomcat端口修改mysql 安装

Centos7

1、SSH默认端口

1)、vi /etc/ssh/sshd_config

   #Port 22         //这行去掉#号
   Port 2222      //下面添加这一行

   service sshd restart

  service sshd status

servicservice sshd restarte sshd restart

   service sshd restart
2)、修改SELinux

    semanage port -l | grep ssh   //命令查看

    semanage port -a -t ssh_port_t -p tcp 2222  //添加端口到SELinux


3)、默认防火墙firewalld 禁用

    systemctl stop firewalld.service  //禁用
    systemctl disable firewalld.service //禁用

安装iptables防火墙
yum install iptables-services #安装


    vi /etc/sysconfig/iptables
    增加一行
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 2222 -j ACCEPT

如果没有安装iptables可以直接用yum安装

yum install -t iptables

检查iptables服务的状态,

service iptables status

如果出现“iptables: Firewall is not running”,说明没有启动或没有规则
启动iptables服务

service iptables start



 保存重启

service iptables save
service iptables restart

代码如下:

/etc/init.d/iptables status 会得到一系列信息,说明防火墙开着。
/etc/rc.d/init.d/iptables stop 关闭防火墙

最后:
在根用户下输入setup,进入一个图形界面,选择Firewall configuration,进入下一界面,选择Security Level为Disabled,保存。重启即可。





2、
 1)、新建用户

   useradd sf2016  //新用户
   passwd  sf2016  //设密码

 2)、JDK64安装

     chmod 755  jdk-linux_64.rpm   //root状态
     rpm -ivh   dk-linux_64.rpm     //root状态

     vi .bash_profile              //sf2016 (非root用户使用)
     在bash_profile文件最后添加以下语句:
     #set java environment
     JAVA_HOME=/usr/java/jdk1.7.0_23
     export JAVA_HOME

     java -version

 3)、Tomcat安装

      tar -zxvf  apache-tomcat-xxx.tar.gz
      apache-tomcat-xxx/bin/ ./startup.sh //启动

      ps -ef |grep tomcat
      ps -ef |grep 8080


      http://l92.168.11.112:8080

      tomcat端口修改
      conf/server.xml
      <Connector port="8000" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
      http://l92.168.11.112:8080

3、mysql 安装

        http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm
    http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.rhel5.x86_64.rpm
    http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.21-1.rhel5.x86_64.rpm


[root@linuxidc tools]# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm
[root@linuxidc tools]# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.rhel5.x86_64.rpm
[root@linuxidc tools]# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.21-1.rhel5.x86_64.rpm
 
       1)、mysql_service安装

         rpm -ivh MySQL-server-5.5.8-1.rhel5.i386.rpm

2、安装iptables防火墙
yum install iptables-services #安装
vi /etc/sysconfig/iptables #编辑防火墙配置文件
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
:wq! #保存退出
systemctl restart iptables.service #最后重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动

原文地址:https://www.cnblogs.com/smallfa/p/4922874.html