tar -zxvf jdk-8u212-linux-x64.tar.gz -C /opt/module/
(1)新建/etc/profile.d/my_env.sh文件
sudo vim /etc/profile.d/my_env.sh
添加如下内容
#JAVA_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_212
export PATH=$PATH:$JAVA_HOME/bin
(2)保存后退出
:wq
(3)source一下/etc/profile文件,让新的环境变量PATH生效
source /etc/profile
java -version
tar -zxvf apache-tomcat-9.0.65.tar.gz -C /opt/module/
/opt/module/apache-tomcat-9.0.65/bin/startup.sh
结果:
yum install -y git
结果:
git --version
git config --global user.name "mo.jz"
git config --global user.email "[email protected]"
git config --list
MySQL :: Download MySQL Community Server
#先解压xz文件成tar文件
xz -d /opt/software/mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz
#解压tar文件注意是-xvf
tar -xvf /opt/software/mysql-8.0.30-linux-glibc2.12-x86_64.tar -C /opt/module/
mv mysql-8.0.30-linux-glibc2.12-x86_64/ /usr/local/mysql/mysql-8.0.30
data
文件夹mkdir -p /usr/local/mysql/mysql-8.0.30/data
mysql用户组
groupadd mysql
7.
添加mysql用户
useradd -g mysql mysql
chown -R mysql:mysql /usr/local/mysql/mysql-8.0.30/
mysql.server
至/etc/init.d/mysql
添加mysqld服务到系统cp /usr/local/mysql/mysql-8.0.30/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --level 2345 mysql on #设置开启自动启动
/etc/my.cnf
[client]
default-character-set=utf8mb4
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# The MySQL server
[mysqld]
#配置mysql的文件夹 和 mysql data目录
basedir=/usr/local/mysql/mysql-8.0.30
datadir=/usr/local/mysql/mysql-8.0.30/data
default-storage-engine=INNODB
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 64M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 128K
bind-address = 0.0.0.0
server-id = 1
# Uncomment the following if you want to log updates
#log-bin=mysql-bin
# binary logging format - mixed recommended
#binlog_format=mixed
[mysqldump]
quick
max_allowed_packet = 64M
[mysql]
default-character-set = utf8mb4
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
[mysqlhotcopy]
interactive-timeout
cd /usr/local/mysql/mysql-8.0.30/bin/
./mysqld --initialize --user=mysql --basedir=/usr/local/mysql/mysql-8.0.30
结果:记住密码
```bash
./mysqld_safe --user=mysql
```
这里如果报错
> ./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
执行:
```bash
sudo ln -s /usr/lib64/libtinfo.so.6.1 /usr/lib64/libtinfo.so.5
```
或者:
出现该问题首先检查该链接库文件有没有安装使用 `rpm -qa|grep libaio`命令进行核查
运行该命令后发现系统中无该链接库文件
使用命令,yum install libaio-devel.x86_64
安装
ln -s /usr/local/mysql/mysql-8.0.30/bin/mysql /usr/bin
./mysql -uroot -p
输入密码:
gq-(CQ_oi3rZ
报错解决:./mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
ln -s /usr/lib64/libtinfo.so.6.1 /usr/lib64/libtinfo.so.5
root为你的新密码:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
flush privileges;
use mysql;
update user set host='%' where user='root';
flush privileges;
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload
service mysql start #启动MySQL
service mysql stop #停止MySQL
service mysql restart #重启MySQL
service mysql status #查看MySQL状态
远程连接成功
yum install -y wget
wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
tar -zxvf /opt/software/apache-maven-3.8.6-bin.tar.gz -C /usr/local/maven
#我是自己搞了个文件专门用来放maven环境配置,也可以直接放入vi /etc/profile中
vim /etc/profile.d/my_mvn.sh
#写入以下内容
#MAVEN_HOME
export MAVEN_HOME=/usr/local/maven/maven-3.8.6
export PATH=$PATH:$MAVEN_HOME/bin
source /etc/profile
mvn -version
mkdir /usr/local/maven/repository
进入目录
cd /usr/loacl/maven/maven-3.8.6/conf
添加本地仓库位置和阿里云镜像位置
添加本地仓库
/opt/jarstore
添加阿里云(删除本来的mirror地址先)
alimaven
central
aliyun maven
https://maven.aliyun.com/repository/central
alimaven
aliyun maven
http://maven.aliyun.com/nexus/content/groups/public/
central
进入目录
cd /项目
打包
mvn clean package
查看jar包
cd /项目/target
1.因为Nginx依赖于gcc的编译环境,所以,需要安装编译环境来使Nginx能够编译起来。
命令:yum install gcc-c++
2.Nginx的http模块需要使用pcre来解析正则表达式,需要安装pcre。
命令:yum install -y pcre pcre-devel
3.安装依赖的解压包。
命令:yum install -y zlib zlib-devel
4.ssl 功能需要 openssl 库,安装 openssl。
命令:yum install -y openssl openssl-devel
wget https://nginx.org/download/nginx-1.22.0.tar.gz
tar -zxvf nginx-1.22.0.tar.gz -C /usr/local/nginx/
//进入nginx目录
cd /usr/local/nginx
//进入目录
cd nginx-1.22.0
//执行命令 考虑到后续安装ssl证书 添加两个模块
./configure --with-http_stub_status_module --with-http_ssl_module
//执行make命令
make
//执行make install命令
make install
配置nginx.conf
vim /usr/local/nginx/conf/nginx.conf
默认端口是80,因为可能会和Apache使用的端口冲突,这里改为8089;server_name修改为Linux的IP地址就可以。
启动nginx服务
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
##或者
进入/usr/loacal/nginx/sbin
执行./nginx
ps -ef | grep nginx
进入安装目录中,
命令: cd /usr/local/nginx/sbin
启动,关闭,重启,命令:
./nginx 启动
./nginx -s stop 关闭
./nginx -s reload 重启
命令: yum install -y gcc-c++
创建好目录/usr/local/redis并进入目录
wget https://github.com/redis/redis/archive/7.0.4.tar.gz
tar -zxvf 7.0.4.tar.gz -C ./
1.进入redis目录并执行make命令编译
----因为目录里二进制文件,要通过make编译一下
cd redis-7.0.4/
make
2.安装
安装到/usr/local/redis 目录里
执行安装命令
make PREFIX=/usr/local/redis install
说明一下两个文件夹,bin是redis的一些执行文件,redis-7.0.4里面是一些配置信息
redis-server 是redis服务器
redis-cli 是redis客户端
创建my_conf文件夹,来存放自己的redis.conf配置文件,把redistribution.conf复制过来
mkdir my_conf
cp ../redis-7.0.4/redis.conf ./my_conf/
./redis-server my_conf/redis.conf
出现这个表示服务器启动成功
在xshell新建一个会话,连接此地址linux服务器
进入到/usr/local/redis/bin
cd /usr/local/redis/bin
连接6379端口的redis
./redis-cli -p 6379