jdk下载
解压命令: tar -zxvf jdk-8u301-linux-x64.tar.gz
输入命令 :vim /etc/profile
输入i 插入以下代码
export JAVA_HOME=/usr/local/jdk1.8.0_301
export JRE_HOME=${JAVA_HOME}/jre
export CATALINA_HOME=/usr/local/tomcat
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:${CATALINA_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
按ESC + :wq! 保存退出
输入命令: java -version
查看是否能查询jdk版本号
下载nacos
输入命令: tar -zxvf nacos-server-2.0.3.tar.gz
进入nacos的bin目录输入命令:
sh startup.sh -m standalone
vim /lib/systemd/system/nacos.service
直接粘贴以下内容,Description为描述,After=network.target表示在网口启动后启动
[Unit]
Description=nacos
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nacos/bin/startup.sh -m standalone
ExecReload=/usr/local/nacos/bin/shutdown.sh
ExecStop=/usr/local/nacos/bin/shutdown.sh
PrivateTmp=true
[Install]
WantedBy=multi-user.target
其中的jdk路径以自己实际安装路径为准
#!/bin/bash
# Copyright 1999-2018 Alibaba Group Holding Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cygwin=false
darwin=false
os400=false
case "`uname`" in
CYGWIN*) cygwin=true;;
Darwin*) darwin=true;;
OS400*) os400=true;;
esac
error_exit ()
{
echo "ERROR: $1 !!"
exit 1
}
[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/local/jdk1.8.0_351
#[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
#[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
#[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/opt/taobao/java
#[ ! -e "$JAVA_HOME/bin/java" ] && unset JAVA_HOME
if [ -z "$JAVA_HOME" ]; then
if $darwin; then
if [ -x '/usr/libexec/java_home' ] ; then
"startup.sh" 149L, 5229C
systemctl daemon-reload #重新加载服务配置
systemctl enable nacos.service #设置为开机启动
systemctl start nacos.service #启动nacos服务
systemctl stop nacos.service #停止nacos服务
systemctl stop firewalld.service #停止防火墙
systemctl disable firewalld.service #禁止防火墙开机启动
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
下载nginx
输入命令: tar -zxvf nginx-1.22.0.tar.gz
首先进入 nginx目录:
cd nginx
输入以下命令: ./configure
make
make install
进入/usr/local/nginx/sbin目录
输入: ./nginx
如果出现无法访问情况:
添加端口外部访问权限(这样外部才能访问):
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload
vi /etc/systemd/system/nginx.service
[Unit]
Description=nginx service
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
设置开机自启动
systemctl daemon-reload
systemctl enable nginx
先用此命令启停一下 看配置是否正常
systemctl start nginx # nginx启动
systemctl stop nginx # nginx停止
yum list installed | grep mysql (检查是否有安装mysql)
yum list installed | grep mariadb (检查是否有安装mariadb )
v 数据库名称
同时删除/etc/目录下的my.cnf文件:
rm –rf /etc/my.cnf
命令: wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
如果未安装wegt,先安装wegt:
sudo yum install wget
sudo rpm -ivh mysql57-community-release-el7-8.noarch.rpm(如果使用此命令出现以下异常)
使用以下命令:
yum -y remove mariadb-libs
#接下来在执行安装命令
yum install mysql-community-server
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
yum install mysql-community-server #安装命令
当第一次启动MySQL服务器时,为MySQL根用户生成一个临时密码。 您可以通过运行以下命令找到密码:
sudo grep 'temporary password' /var/log/mysqld.log
运行该命令后会出现一个密码,在localhost后面。也可以直接去/var/log/mysqld.log这个目录下找,这个文件里有,如果这个文件为空:
rm -rf /var/lib/mysql
systemctl restart mysqld
grep ‘temporary password’ /var/log/mysqld.log
配置mysql安装项:
sudo mysql_secure_installation
输入刚才的临时密码
接下来mysql会提示你输入新的密码,和一下其他设置,一般情况下我们都会输入y(密码必须至少包含8个字符并且至少包含一个大写字母,一个小写字母,一个数字和一个特殊字符。)
mysql -uroot -p(你设置的密码)
set global validate_password_policy=0;
设置密码长度根据个人:
set global validate_password_length=4;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '1234(设置新密码)' WITH GRANT OPTION;
//刷新权限。 然后同样重启MySQL生效
FLUSH PRIVILEGES;
代表所有库表,若想给予所有root权限,”root”写成“%”,的意思是给予来自所有IP地址的通过“用户”,“密码”登录的用户对所有库表的所有操作权限。
firewall-cmd --zone=public --add-port=3306/tcp --permanent (--permanent永久生效,没有此参数重启后失效)
firewall-cmd --reload
添加端口外部访问权限(这样外部才能访问)
安装C++环境命令:
yum install gcc-c++
解压redis命令:
tar -zxvf redis-7.0.4.tar.gz
进入redis目录下执行
编译命令:
make
安装命令:
make install
可对关键字搜索: daemonize
可对关键字搜索: bind 127.0.0.1 -::1
可对关键字搜索: protected-mode
进入/usr/local/bin目录下
输入以下命令启动redis:
redis-server myredis.conf
测试连接:
redis-cli
如果出现告警
方式一:设置的值128较低,需要“echo 511 > /proc/sys/net/core/somaxconn”命令,注意此命令只是暂时生效,如果重启后就会失效。
方式二:永久解决Redis中The TCP backlog setting of 511 cannot be enforced告警问题,编辑/etc/sysctl.conf文件,添加net.core.somaxconn = 1024然后执行sysctl -p命令查看是否添加成功,之后重启Redis服务即可。
在这里面添
net.core.somaxconn= 1024
vm.overcommit_memory = 1
然后执行
sysctl -p
就可以永久消除这个warning
vi /etc/systemd/system/redis.service
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server /usr/local/bin/myredis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
设置开机自启动
systemctl daemon-reload
systemctl start redis.service
systemctl enable redis.service
reboot #重启