centOS服务器安装环境

防火墙使用:

防火墙状态 systemctl status firewalld
开启防火墙 systemctl start firewalld
关闭防火墙 systemctl stop firewalld

遇到无法开启
先用:systemctl unmask firewalld.service
然后:systemctl start firewalld.service
查看想开的端口是否已开:
firewall-cmd --query-port=80/tcp
添加指定需要开放的端口:
firewall-cmd --add-port=80/tcp --permanent
重载入添加的端口:
firewall-cmd --reload
查询指定端口是否开启成功:
firewall-cmd --query-port=80/tcp
移除指定端口:
firewall-cmd --permanent --remove-port=80/tcp

mysql5.6

# 查看已安装的数据库
rpm -qa | grep mysql
rpm -qa|grep -i mariadb
# 卸载已安装的 Mariadb 数据库。
rpm -qa|grep mariadb|xargs rpm -e --nodeps
# 下载安装包文件。
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
# 安装mysql-community-release-el7-5.noarch.rpm包
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-server
# 检查mysql是否安装成功。
rpm -qa | grep mysql

systemctl start mysqld.service #启动 mysql
systemctl restart mysqld.service #重启 mysql
systemctl stop mysqld.service #停止 mysql
systemctl enable mysqld.service #设置 mysql 开机启动

# 设置密码 
mysql> use mysql;
mysql> update user set password=PASSWORD("这里输入root用户密码") where User='root';
mysql> flush privileges;
设置远程主机登录
GRANT ALL PRIVILEGES ON *.* TO [email protected]"%" IDENTIFIED BY "123456";

Java

wget https://download.oracle.com/otn/java/jdk/8u221-b11/230deb18db3e4014bb8e3e8324f81b43/jdk-8u221-linux-x64.rpm

rpm -ivh jdk-8u221-linux-x64.rpm

vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_221-amd64
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

source /etc/profile

redis

yum install -y epel-release  #安装epel源
yum install -y redis

systemctl enable redis.service
systemctl start redis.service

# 编辑 /etc/redis.conf 注释掉bind 127.0.0.1 或者绑定 bind 0.0.0.0 可以使所有的ip访问redis,若是想指定多个ip访问,但并不是全部的ip访问,可以bind。
# 在redis3.2之后,redis增加了protected-mode,在这个模式下,即使注释掉了bind 127.0.0.1,再访问redisd时候还是报错。修改 protected-mode 为 no
# 可选 修改daemonize 为 yes 确保守护进程开启。

rabbitMQ

wget http://erlang.org/download/otp_src_22.0.tar.gz
tar -xzf otp_src_22.0.tar.gz -C /opt/
# Erlang依赖安装
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC-devel libtool libtool-ltdl-devel
cd otp_src_22.0
# 重新编译的时候执行这条命令,如果是首次执行编译,可以不用执行这条命令
./otp_build autoconf
./configure
make
make install

vi /etc/profile
export ERLANG_HOME=/usr/local/lib/erlang
# 如果已经有PATH 则  将   :$ERLANG_HOME/bin  拼接到PATH 后面
export PATH=$PATH:$ERLANG_HOME/bin
source /etc/profile
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.17/rabbitmq-server-3.7.17-1.el7.noarch.rpm

yum install socat -y

rpm -ivh rabbitmq-server-3.7.17-1.el7.noarch.rpm
yum install rabbitmq-server-3.7.17-1.el7.noarch.rpm
# 若不存在rabbitmq.conf文件
vim /etc/rabbitmq/rabbitmq.conf
#将 https://github.com/rabbitmq/rabbitmq-server/blob/master/docs/rabbitmq.conf.example 内容复制到该文件中
# 开机启动
systemctl enable rabbitmq-server.service
#关闭
systemctl stop rabbitmq-server.service
#启动
systemctl start rabbitmq-server.service
#状态
systemctl status rabbitmq-server.service
rabbitmq-plugins enable rabbitmq_management
[[email protected] otp_src_22.0]# cd /sbin/
[[email protected] sbin]# ./rabbitmqctl add_user admin admin
Adding user "admin" ...
[[email protected] sbin]# ./rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...
[[email protected] sbin]# ./rabbitmqctl list_users
Listing users ...
user    tags
admin   [administrator]
guest   [administrator]

插件管理:
插件列表: rabbitmq-plugins list
启动插件: rabbitmq-plugins enable XXX (XXX为插件名)
停用插件: rabbitmq-plugins disable XXX
用户管理:
添加用户: rabbitmqctl add_user username password
删除用户: rabbitmqctl delete_user username
修改密码: rabbitmqctl change_password username newpassword
设置用户角色: rabbitmqctl set_user_tags username tag
列出用户: rabbitmqctl list_users
权限管理:
列出所有用户权限: rabbitmqctl list_permissions
查看制定用户权限: rabbitmqctl list_user_permissions username
清除用户权限: rabbitmqctl clear_permissions [-p vhostpath] username
设置用户权限: rabbitmqctl set_permissions [-p vhostpath] username conf write read
conf: 一个正则匹配哪些资源能被该用户访问
write:一个正则匹配哪些资源能被该用户写入
read:一个正则匹配哪些资源能被该用户读取

nodejs

curl --silent --location https://rpm.nodesource.com/setup_10.x | bash -
yum install -y nodejs
node -v
npm install -g cnpm --registry=https://registry.npm.taobao.org
点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注