Java 安装
- 查看自带JDK是否已安装
$ yum list installed |grep java
- 卸载JDK
$ yum -y remove java-1.7.0-openjdk*
- 卸载tzdata-java
$ yum -y remove tzdata-java.noarch
- 查看yum库中的Java安装包
$ yum -y list java*
- 安装java8
$ yum -y install java-1.8.0-openjdk*
Mysql安装推荐使用这篇
https://www.jianshu.com/p/9a10640f3ec4
Mysql 安装 -弃用
- 查看是否安装mysql
$ rpm -qa | grep mysql
$ yum list installed | grep mysql
- 卸载mysql
$ rpm -e mysql // 普通删除模式
$ rpm -e --nodeps mysql // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
$ yum -y remove mysql-xxxxxx
- 安装
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
$ rpm -ivh mysql-community-release-el7-5.noarch.rpm
$ yum install mysql-server
$ service mysql start #提示 Failed to start mysqld.service: Unit not found 使用systemctl start mariadb.service启动
$ service mysql stop
提示 Failed to start mysqld.service: Unit not found
https://www.cnblogs.com/progor/archive/2018/01/30/8387301.html
Mysql安装推荐使用这篇
https://www.jianshu.com/p/9a10640f3ec4
启动maria DB服务
systemctl start mariadb.service
添加至开机自启动
systemctl enable mariadb.service
- 登陆
$ mysql -uroot -p //登陆 默认密码空
- 显示库
> show databases;
- 创建库
create database aibawang
- 查看用户
> select Host,User,Password from mysql.user;
- 创建用户
> create user 用户 identified by '密码';
- 用户分配权限
*.* 代表所有库下面的所有表 %代表这个用户允许从任何地方登录
> grant all privileges on 库名.* to '用户'@'%'identified by '密码' with grant option;
- 刷新
> flush privileges;
- 修改指定用户密码
> update mysql.user set password=password('新密码') where User="xxxxx" and Host="%";
- 删除用户
> delete from user where User='xxxxx' and Host='localhost';
Redis 安装 https://www.cnblogs.com/rslai/p/8249812.html
#下载fedora的epel仓库
yum install epel-release
$ yum install redis
# 启动redis
service redis start
# 停止redis
service redis stop
# 查看redis运行状态
service redis status
# 查看redis进程
ps -ef | grep redis
- 配置文件修改
$ vim /etc/redis.conf
- 添加密码
requirepass 123456
- 启动redis
$ service redis start
- 停止redis
$ service redis stop
- 查看redis运行状态
$ service redis status
- 查看redis进程
$ ps -ef | grep redis
- 设置redis为开机自动启动
$ chkconfig redis on
- 客户端
$ redis-cli
Nginx 安装
- 安装nginx依赖
$ yum install glibc-devel.x86_64
$ yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
$ wget https://ftp.pcre.org/pub/pcre/pcre-8.35.tar.gz
$ tar zxvf pcre-8.35.tar.gz
$ cd pcre-8.35
$ ./configure
$ make && make install
检测pcrea安装是否成功 路径
pcre-config --prefix
查看版本号pcre-config --version
路径结构
/usr/local/src/nginx-1.6.2
/usr/local/src/pcre-8.35
- 下载nginx
$ wget http://nginx.org/download/nginx-1.6.2.tar.gz
$ tar zxvf nginx-1.6.2.tar.gz
$ cd nginx-1.6.2
$ make install
$ ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
最终nginx安装在
/usr/local/nginx
启动
$ cd /usr/local/nginx
$ ./sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
- 配置文件
user root;
worker_processes 2;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream ip {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name localhost;
client_max_body_size 1000M;
location / {
proxy_pass http://ip;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
- 重新加载 修改
/usr/local/nginx/conf/nginx.conf
$ ./sbin/nginx -s reload
- 错误
./sbin/nginx -s reload
nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"
// 解决
$ /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
Tomcat 安装
$ wget http://www.us.apache.org/dist/tomcat/tomcat-8/v8.5.35/bin/apache-tomcat-8.5.35.tar.gz
$ tar zxvf apache-tomcat-8.5.35.tar.gz
防火墙开启端口
#防火墙开通端口
iptables -A INPUT -p tcp --dport 3360 -j ACCEPT
iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 8010 -j ACCEPT
iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 8020 -j ACCEPT
iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 6379 -j ACCEPT
iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
service iptables save
iptables -nvL
iptables restart