记一次centos7.3开发环境配置
以root身份运行修改网络配置:(确认网卡是否正确插上)
ip a # 查看正在使用的是那块网卡,例如em1
修改网络使用知道ip:
vi /etc/sysconfig/network-scripts/ifcfg-em1
将对应位置进行修改,确保能够联网
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=em1
UUID=b9961f0a-487e-4a5b-b3aa-ab4b2dbafc20
DEVICE=em1
ONBOOT=yes
DNS1=202.96.128.86
IPADDR=192.168.2.168
PREFIX=24
GATEWAY=192.168.2.254
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no
centos7的jdk安装及配置
https://www.oracle.com/technetwork/java/javase/downloads/index.html 官网下载jdk1.8的linux解压缩安装包(.gz结尾)
mkdir /usr/local/java
cd /usr/local/java
使用scp远程工具将jdk-jdk1.8.0_172-linux-x64.tar.gz包拖到当前目录/usr/local/java
tar zxvf jdk-jdk1.8.0_172-linux-x64.tar.gz
配置环境变量(root权限)
vim /etc/profile
在最后位置添加
export JAVA_HOME=/home/java/jdk1.8.0_172
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
保存退出
source /etc/profile让profile 文件立即生效
验证:
java -version
tomcat8.0.53安装:
https://tomcat.apache.org/download-80.cgi 选择64位版本即可,解压后 使用scp工具上传到服务器/usr/local/java 目录下
配置文件:在conf里
启动:进入bin 使用命令启动,关闭
./catalina.sh start
./catalina.sh stop
mysql5.7.23 yum安装配置
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm #下载mysql官方yum repository
yum -y install mysql57-community-release-el7-10.noarch.rpm # 更新yum源
yum -y install mysql-community-server # 安装mysql服务
systemctl start mysqld.service # 启动mysql服务
systemctl enable mysqld.service # 开机自启
systemctl restart mysqld.service # 重启
systemctl stop mysqld.service
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; #修改root密码
grant all privileges on *.* to root@'%' identified by "root"; # 修改数据库访问权限
flush privileges; #刷新配置
zookeeper 3.4.6安装配置:
在/usr/local/java目录下
wget http://archive.apache.org/dist/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
tar -zxf zookeeper-3.4.6.tar.gz
cd /usr/local/java/zookeeper-3.4.
在主目录下创建data和logs两个目录用于存储数据和日志
mkdir data;mkdir logs
cd /usr/local/java/zookeeper-3.4.6/conf
cp zoo_simple.cfg zoo.cfg
将下面配置写入到zoo.cfg
Dir=/usr/local/java/zookeeper-3.4.6/data
dataLogDir=/usr/local/java/zookeeper-3.4.6/logs
cd /usr/local/java/zookeeper-3.4.6/bin
使用脚本:启动、停止、重启分和查看当前节点状态
./zkServer.sh start
./zkServer.sh stop
./zkServer.sh restart
./zkServer.sh status
redis3.2.12 使用yum安装及配置:
yum info redis #确认是否有redis的安装包
yum install epel-release #下载fedora的epel仓库
yum install redis -y #安装redis
rpm -ql redis # 查看redis配置信息
# 启动redis
systemctl start redis.service
# 停止redis
systemctl stop redis.service
# 查看redis运行状态
systemctl status redis.service
# 查看redis进程
ps -ef | grep redis
systemctl enable redis # 设置开机自启
备注:
可通过下面命令开放端口
iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
iptables -I INPUT 1 -p tcp --dport 6379 -j ACCEPT
iptables -I INPUT 1 -p tcp --dport 2181 -j ACCEPT
iptables -I INPUT 1 -p tcp --dport 3306 -j ACCEPT