1.jdk1.8
1.解压
tar -zxvf jdk-8u381-linux-x64.tar.gz -C /usr/local/java
2.环境配置
## 安装vim
yum -y install vim
## 配置文件
vim /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_381
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
## 重载配置文件
source /etc/profile
2.mysql8
1.删除mariadb 安装libaio和numactl
rpm -qa|grep mariadb
rpm -e --nodeps mariadb-libs
yum -y install libaio
yum -y install numactl
2.解压
## 拆分tar包
tar -xvf mysql-8.0.30-el7-x86_64.tar
## 解压安装包
tar -zxvf mysql-8.0.30-el7-x86_64.tar.gz
## mv重命名
mv mysql-8.0.30-el7-x86_64/ /usr/local/mysql
3.创建用户组 用户
## 创建用户组
groupadd mysql
## 创建用户 -r:创建系统用户-g:指定用户组
useradd -r -g mysql mysql
## 更改属主和数组
chown -R mysql:mysql /usr/local/mysql/
## 更改权限
chmod -R 755 /usr/local/mysql/
4.初始化mysql
## 初始化mysql
cd /usr/local/mysql/bin/
./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql
5.环境配置
vim /etc/my.cnf
[client]
port = 3306
socket = /usr/local/mysql/data/mysql.sock
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
init_connect = 'SET NAMES utf8mb4'
port = 3306
socket = /usr/local/mysql/data/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
datadir = /usr/local/mysql/data
#lower_case_table_names=1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
## 修改my.cnf权限为777
chmod 777 /etc/my.cnf
chmod 644 /etc/my.cnf
6.启动mysql
## 测试
/usr/local/mysql/support-files/mysql.server start
## 设置软连接启动
ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
ln -s /usr/local/mysql/mysql.sock /var/mysql.sock
service mysql restart
## 修改密码
mysql -uroot -p
alter user 'root'@'localhost' identified by '125803';
## 开放远程连接
mysql> use mysql;
msyql> update user set user.Host='%' where user.User='root';
mysql> flush privileges; //刷新权限
## 防火墙放行3306
systemctl status firewalld
firewall-cmd --permanent --query-port=3306/tcp ## 查询端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent ## 开放端口
firewall-cmd --zone=public --remove-port=3306/tcp --permanent ## 删除端口
firewall-cmd --reload
firewall-cmd --zone=public --list-ports ## 查看开放端口列表
7.开机自启
## 拷贝文件
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --list
## 如果看到mysqld的服务,并且3,4,5都是on的话则成功,如果是off,则执行
chkconfig --level 345 mysqld on
reboot
ps -ef|grep mysql
3.redis
1.安装gcc
## redis6要求gcc版本5.2+
yum install -y gcc
gcc -v
## 更新
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
## 长期使用gcc 9.1
echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile
2.下载解压安装包
cd /usr/local/
yum -y install wget
wget https://download.redis.io/releases/redis-6.2.9.tar.gz
## 解压
tar -zxf ./redis-6.2.9.tar.gz
3.安装
mv redis-6.2.9 redis
cd redis
## 测试
make test
## ERROR
You need tcl 8.5 or newer in order to run the Redis test
make[1]: *** [test] 错误 1
make[1]: 离开目录“/usr/local/redis-6.2.6/src”
make: *** [test] 错误 2
## 解决方案
yum install tcl
make install
4.环境配置
## 备份原始配置文件
mkdir conf
cp redis.conf ./conf
## 测试启动
./src/redis-server ./redis.conf
cd ~
vim .bash_profile
## 添加
export REDIS_HOME=/usr/local/redis
export PATH=$REDIS_HOME/src:$PATH
source .bash_profile
## 变量配置生效
redis-cli -v
## 修改环境配置
vim /usr/local/redis/redis.conf
# 注释掉这句,允许远程连接
bind 127.0.0.1
# 允许后台运行服务
daemonize yes
# 关闭保护模式,否则外部ip无法连接
protected-mode no
# 配置登录验证密码
requirepass 000
5.启动
redis-server /usr/local/redis/redis.conf
## 防火墙开放端口
firewall-cmd --zone=public --add-port=6379/tcp --permanent
firewall-cmd --reload
标签:linux,##,配置,redis,--,开发,usr,mysql,local
From: https://blog.51cto.com/u_16254089/7413003