yum -y install gcc gcc-c++ autoconf automake libtool make cmake zlib zlib-devel openssl openssl-devel pcre-devel vim traceroute httpd-tools wget net-tools zip unzip
vim 配置修改
vim /etc/vimrc
hi comment ctermfg=6
if has("autocmd")
filetype indent on
autocmd FileType \* setlocal ts=4 sts=4 sw=4 ai et nu
autocmd FileType make setlocal ts=4 sts=4 sw=4 noet nu
endif
添加用户
userdel -r test #删除用户和用户主目录下所有文件,不加-r删除用户文件不删除
groupdel testgroup #删除用户组
adduser test
passwd test
su test
mkdir apps softwares newapps
linux 下普通用户添加 sudo 免密码
sudo vim /etc/sudoers
#在代码的最后加上:
test ALL=(ALL)NOPASSWD:ALL
安装 jdk
cd softwares
wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz
tar -zxvf jdk-17_linux-x64_bin.tar.gz
配置 jdk
cd ~
vim .bashrc
export JAVA_HOME=/home/test/apps/jdk1.8.0_121
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
防火墙配置
su
cd /etc/firewalld/zones/
vim public.xml
#添加 2 行
<service name="mysql"/>
<service name="test"/>
#然后 cd ../services/
vim test.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>test</short>
<description>test</description>
<port protocol="tcp" port="8080"/>
<port protocol="tcp" port="8161"/>
<port protocol="tcp" port="7070"/>
</service>
安装 nginx
cd softwares
yum -y install gcc gcc-c++ autoconf automake libtool make cmake zlib zlib-devel openssl openssl-devel pcre-devel net-tools zip unzip
wget https://nginx.org/download/nginx-1.26.1.tar.gz
./configure --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-stream --with-stream_ssl_preread_module --with-http_gzip_static_module --with-http_realip_module
make & make install
nginx 配置
vim /etc/profile
export NGINX_HOME=/usr/local/nginx
export PATH=$NGINX_HOME/sbin:$PATH
source /etc/profile
#修改root密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'g#4Ih^4F';
CREATE DATABASE IF NOT EXISTS test_boot_prod DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
source /home/test/apps/test_boot_dev.sql
FLUSH PRIVILEGES;#刷新权限
create user 'test'@'%' identified by 'jkk3NzZIwYRry5q8';
grant all privileges on test_boot_prod._ to "test"@'%';
grant all privileges on test_boot_prod.\* to "test"@'%';
Linux centos7 安装字体文件,解决 Probable fatal error:No fonts found.
vim /etc/rc.d/rc.local
/usr/local/nginx/sbin/nginx
su - test -c "sh /home/test/autostart.sh"
chmod +x /etc/rc.d/rc.local
vim /home/test/autostart.sh
#/bin/sh/home/test/apps/mysql-8.0.26/startup.sh
/home/test/apps/redis-5.0.3/startup.sh
sleep 30s
/home/test/newtest/apps/startup.sh test-test-boot