(一)基本操作修改
-
修改主机名
vi /etc/sysconfig/networkNETWORKING=yes
HOSTNAME=server1.itcast.cn 修改ip地址
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.101
NETMASK=255.255.255.0
service network restart
- 修改ip地址和主机名的映射关系
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.101 server1.itcast.cn
-
关闭iptables并设置其开机启动/不启动
service iptables stop
chkconfig iptables on
chkconfig iptables off
(二)安装操作
安装JDK
- 上传jdk-7u45-linux-x64.tar.gz到Linux上
- 解压jdk到/usr/local目录
tar -zxvf jdk-7u45-linux-x64.tar.gz -C /usr/local/ -
设置环境变量,在/etc/profile文件最后追加相关内容
vi /etc/profileexport JAVA_HOME=/usr/local/jdk1.7.0_45
export PATH=$PATH:$JAVA_HOME/bin - 刷新环境变量
source /etc/profile 测试java命令是否可用
java -version
安装Tomcat
- 上传apache-tomcat-7.0.68.tar.gz到Linux上
- 解压tomcat
tar -zxvf apache-tomcat-7.0.68.tar.gz -C /usr/local/ - 启动tomcat
/usr/local/apache-tomcat-7.0.68/bin/startup.sh - 查看tomcat进程是否启动
jps
- 查看tomcat进程端口
netstat -anpt | grep 2465 - 通过浏览器访问tomcat
http://192.168.0.101:8080/
安装MySQL
- 上传MySQL-server-5.5.48-1.linux2.6.x86_64.rpm、MySQL-client-5.5.48-1.linux2.6.x86_64.rpm到Linux上
- 使用rpm命令安装MySQL-server-5.5.48-1.linux2.6.x86_64.rpm,缺少perl依赖
rpm -ivh MySQL-server-5.5.48-1.linux2.6.x86_64.rpm - 安装perl依赖,上传6个perl相关的rpm包
rpm -ivh perl-* - 再安装MySQL-server,rpm包冲突
rpm -ivh MySQL-server-5.5.48-1.linux2.6.x86_64.rpm
- 卸载冲突的rpm包
rpm -e mysql-libs-5.1.73-5.el6_6.x86_64 --nodeps - 再安装MySQL-client和MySQL-server
rpm -ivh MySQL-client-5.5.48-1.linux2.6.x86_64.rpm
rpm -ivh MySQL-server-5.5.48-1.linux2.6.x86_64.rpm - 启动MySQL服务,然后初始化MySQL
service mysql start
/usr/bin/mysql_secure_installation - 测试MySQL
mysql -u root -p