安装软件一般有三种方式:
# 检查
[root@kuangshen ~]# rpm -qa|grep jdk
jdk1.8.0_121-1.8.0_121-fcs.x86_64
# 卸载 -e --nodeps 强制删除
[root@kuangshen ~]# rpm -e --nodeps jdk1.8.0_121-1.8.0_121-fcs.x86_64
[root@kuangshen ~]# java -version
-bash: /usr/bin/java: No such file or directory # OK
[root@localhost lml]# rpm -ivh jdk-15.0.2_linux-x64_bin.rpm
JAVA_HOME=/usr/java/jdk-15.0.2
CLASSPATH=%JAVA_HOME%/lib
PATH=$PATH:$JAVA_HOME/bin
export PATH CLASSPATH JAVA_HOME
[root@localhost etc]# source /etc/profile
1、安装好了Java环境后我们可以测试下Tomcat!准备好Tomcat的安装包!
2、将文件移动到/usr/tomcat/下,并解压!
[root@localhost lml]# mv apache-tomcat-9.0.65.tar.gz /usr
[root@localhost lml]# cd /usr
[root@localhost usr]# ls
apache-tomcat-9.0.65.tar.gz etc include lib libexec sbin src
bin games java lib64 local share tmp
[root@localhost usr]# tar -zxvf apache-tomcat-9.0.65.tar.gz
apache-tomcat-9.0.65/conf/
3、 运行Tomcat,进入bin目录,和我们以前在Windows下看的都是一样的
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE: /usr/apache-tomcat-9.0.65
Using CATALINA_HOME: /usr/apache-tomcat-9.0.65
Using CATALINA_TMPDIR: /usr/apache-tomcat-9.0.65/temp
Using JRE_HOME: /usr/java/jdk-15.0.2
Using CLASSPATH: /usr/apache-tomcat-9.0.65/bin/bootstrap.jar:/usr/apache-tomcat-9.0.65/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
4、防火墙规则
# 查看firewall服务状态
systemctl status firewalld
# 开启、重启、关闭、firewalld.service服务
# 开启
service firewalld start
# 重启
service firewalld restart
# 关闭
service firewalld stop
# 查看防火墙规则
firewall-cmd --list-all # 查看全部信息
firewall-cmd --list-ports # 只看端口信息
# 开启端口
开端口命令:firewall-cmd --zone=public --add-port=80/tcp --permanent
开启http: firewall-cmd --add-service=http --permanent
重启防火墙:systemctl restart firewalld.service
命令含义:
--zone #作用域
--add-port=80/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效
5.可选方式(方便),可直接下载到虚拟机【找到官网上下载的版本tar.gz文件,选中并右击,复制链接地址】
wget -i -c https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.65/bin/apache-tomcat-9.0.65.tar.gz
解压:
tar -zvxf apache-tomcat-9.0.65.tar.gz
配置环境变量
export PATH=$PATH:/opt/apache-tomcat-9.0.65/bin
使其生效
source /etc/profile
基于 CentOS 7 安装
官网安装参考手册:https://docs.docker.com/install/linux/docker-ce/centos/
确定你是CentOS7及以上版本
[root@localhost bin]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
3、yum安装gcc相关(需要确保 虚拟机可以上外网 )
yum -y install gcc
yum -y install gcc-c++
4、卸载旧版本
yum -y remove docker docker-common docker-selinux docker-engine
# 官网版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
5、安装需要的软件包
yum install -y yum-utils device-mapper-persistent-data lvm2
6、设置stable镜像仓库
# 错误
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
## 报错
[Errno 14] curl#35 - TCP connection reset by peer
[Errno 12] curl#35 - Timeout
# 正确推荐使用国内的
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
7、更新yum软件包索引
yum makecache fast
8、安装Docker CE
yum -y install docker-ce docker-ce-cli containerd.io
9、启动docker
systemctl start docker
10、测试
docker version
docker run hello-world
11、报错
[root@localhost /]# docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: TLS handshake timeout.
See 'docker run --help'.
解决办法:
Docker 拉取镜像报错Error response from daemon: Get “https://registry-1.docker.io/...:net/http: TLS timeout_AdamShyly的博客-CSDN博客
12、继续测试
docker run hello-world
docker images
1.找到官网上下载的版本tar.gz文件(版本3.6.3),选中并右击,复制链接地址
Index of /dist/maven/maven-3/3.6.3/binaries
2.命令下载到linux服务器,输入命令,等待下载
[root@localhost lml]# wget -i -c https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
3.解压
[root@localhost lml]# tar -zvxf apache-maven-3.6.3-bin.tar.gz
4.配置环境变量
[root@localhost bin]# vim /etc/profile
5.加入环境变量
export PATH=$PATH:/opt/apache-maven-3.6.3/bin
6.使其生效
[root@localhost bin]# source /etc/profile #生效
[root@localhost bin]# echo $PATH #查看变量
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/root/bin:/opt/apache-maven-3.6.3/bin
[root@localhost bin]# mvn -version #查看版本
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/apache-maven-3.6.3
Java version: 1.8.0_121, vendor: Oracle Corporation, runtime: /usr/java/jdk1.8.0_121/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-1160.el7.x86_64", arch: "amd64", family: "unix"
1. 找到官网上下载的版本文件,选中并右击,复制链接地址
https://dev.mysql.com/get/mysql80-community-release-el7-6.noarch.rpm
2. 使用命令下载在linux服务器
wget -i -c https://dev.mysql.com/get/mysql80-community-release-el7-6.noarch.rpm
3. 安装
yum install -y mysql80-community-release-el7-6.noarch.rpm
4. 回到根目录,在yum仓库中找到mysql-community-server.x86_64
cd /
yum list mysql*
yum install -y mysql-community-server.x86_64
5.如果出现错误
Centos7.x下安装mysql8遇到的问题Couldn‘t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
可以参考:Centos7.x下安装mysql8遇到的问题Couldn‘t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022_墨者大数据的博客-CSDN博客 6.启动mysql并查看状态
[root@localhost /]# systemctl start mysqld
[root@localhost /]# systemctl status mysqld
7.查看密码
[root@localhost /]# grep 'password' /var/log/mysqld.log
8.修改密码
[root@localhost /]# mysql -u root -p
9.进入mysql修改密码
alter user root@localhost identified by 'Nowcoder_123'
10.下面是关于牛客网社区开发项目,可忽略
source /opt/sql/init_schema.sql
source /opt/sql/init_data.sql
source /opt/sql/tables_mysql_innodb.sql
1. 直接用yum安装
yum list redis* #找到版本
yum install -y redis.x86_64 #安装
2. 启动服务
systemctl start redis
systemctl status redis
找到官网Apache Kafka上下载的版本tar.gz文件,选中并右击,复制链接地址
https://dlcdn.apache.org/kafka/3.2.0/kafka_2.13-3.2.0.tgz
wget -i -c https://dlcdn.apache.org/kafka/3.2.0/kafka_2.13-3.2.0.tgz
tar -zxvf kafka_2.13-3.2.0.tgz
bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
nohup bin/kafka-server-start.sh config/server.properties 1>/dev/null 2>&1 &
bin/kafka-topics.sh --list --bootstrap-server localhost:9092
wget -i -c https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.4-linux-x86_64.tar.gz
tar -zxvf elasticsearch-7.17.4-linux-x86_64.tar.gz
4.安装ik并解压到/opt/elasticsearch-7.17.4/plugins/ik
unzip -d /opt/elasticsearch-7.17.4/plugins/ik elasticsearch-analysis-ik-7.17.4.zip
5.配置并检查健康情况
# vim config/elasticsearch.yml # 取消下方内容的注释,修改以下内容
cluster.name: nowcoder
path.data: /tmp/elastic/data
path.logs: /tmp/elastic/logs
node.name: node-1
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["node-1"]
# vim config/jvm.options # 取消下方内容的注释,修改以下内容,这两个参数要顶格写。
-Xms512m
-Xmx512m
1. 直接用yum安装
yum list wkhtmltopdf* #找到版本
yum install -y wkhtmltopdf.x86_64 #安装
2. yum安装xvfb,让Linux可视化。因为wkhtmltopdf会生成图片,图片是可视化的。
yum list *xvfb*
yum install -y xorg-x11-server-Xvfb.x86_64
3. 测试
cd /home/lml/test
xvfb-run --server-args="-screen 0, 1024x768x24" wkhtmltoimage https://www.baidu.com 1.png
cd /opt
vim wkhtmltoimage.sh # /opt/wkhtmltoimage.sh文件里只有这一句话
这句话
xvfb-run --server-args="-screen 0, 1024x768x24" wkhtmltoimage "$@"
修改权限并测试
ll
chmod +x wkhtmltoimage.sh
cd /home/lml/test
/opt/wkhtmltoimage.sh https://www.baidu.com 2.png
过程:看nginx 安装 - 深夜独行侠 - 博客园
配置:
[root@localhost sbin]#vim /usr/local/nginx/conf/nginx.conf # http的大括号里,去掉原先的server,加上下面这个
# http是80端口,https是443端口。默认是80端口,于是访问120.77.151.233会变为120.77.151.233:80,然后被服务器中的nginx映射到120.77.151.233:8080。
upstream myserver{
server 127.0.0.1:8080 max_fails=3 fail_timeout=30s;
}
server{
listen 80;
server_name 192.168.239.129;
location / {
proxy_pass http://myserver;
}
}
可能的问题:
需杀死占用80端口的线程:命令查看,然后杀死,可参考
lsof -i:80
[root@localhost sbin]# kill -9 79817
重新启动nginx