[TOC] 目录
目录生成脚本地址:https://www.jianshu.com/p/caa21e6796bd
1.Linux安装 Java
解压文件
// 放在 /usr 目录下 用户都可以访问
tar zxvf jdk-8u171-linux-x64.tar.gz
mv jdk1.8.0_171/ /usr/local/java/
修改配置文件
vim ~/.bashrc
export JAVA_HOME=/home/wansw/jdk8
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin
source ~/.bashrc
2.Linux安装 Tomcat
下载地址
https://tomcat.apache.org/
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.30/bin/apache-tomcat-8.5.30.tar.gz
解压缩
tar -zxvf apache-tomcat-8.5.23.tar.gz
重命名
mv apache-tomcat-8.5.23 tomcat
移动目录
mv tomcat/ /usr/local/
启动
/usr/local/tomcat/bin/startup.sh
停止
/usr/local/tomcat/bin/shutdown.sh
3.Linux安装 redis
官网下载
wget http://download.redis.io/releases/redis-4.0.9.tar.gz
解压文件
tar zxvf redis-4.0.9.tar.gz
安装
sudo yum install gcc
cd redis-4.0.9
make && make install
4.Linux安装 Node
1、官网下载 Linux Binaries 64位
wget https://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-x64.tar.xz
2、解压 文件
xz -d node-v8.11.1-linux-x64.tar.xz
tar xvf node-v8.11.1-linux-x64.tar
mv node-v8.11.1-linux-x64/ node
3、把 bin目录下的文件复制到 /usr/local/bin
cd node/bin/
./node -v
v8.11.1
# 在其他目录下不能使用,
cp npm node /usr/local/bin
或创建连接
ln -s bin/node /usr/local/bin/node
ln -s bin/npm /usr/local/bin/npm
rpm -ivh https://kojipkgs.fedoraproject.org//packages/http-parser/2.7.1/3.el7/x86_64/http-parser-2.7.1-3.el7.x86_64.rpm && yum -y install nodejs
yum update -y
yum install epel-release
5.Linux安装 Nginx
1、官网下载
wget http://nginx.org/download/nginx-1.14.0.tar.gz
2、解压
tar zxvf nginx-1.14.0.tar.gz
mv nginx-1.14.0 nginx
cd nginx
./configure
缺少什么文件就安装什么
# sudo yum install zlib-static.x86_64
# sudo yum install pcre*
make
3、修改配置文件 负载均衡
vim /usr/local/nginx/conf/nginx.conf
upstream tomcat-servers {
server 192.168.199.155:8080;
server 192.168.199.143:8080;
server 192.168.199.198:8080;
}
server {
listen 80;
server_name centos0.com;
location / {
proxy_pass http://tomcat-servers;
}
}
4、命令
nginx # 启动
nginx -s reload # 重启
nginx -s quit # 任务完成停止
nginx -s stop # 强制停止
6.Linux安装 Docker
yum install -y docker-io
使用非 root 用户使用 docker
The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can access it with sudo. For this reason, docker daemon always runs as the root user. To avoid having to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.
(1)创建docker 组
sudo groupadd docker
(2)将当前用户添加到组中
sudo gpasswd -a ${USER} docker
(3)重启 docker 服务
sudo systemctl restart docker
7.Linux安装 MySQL
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall mysql57-community-release-el7-8.noarch.rpm
yum install mysql-community-server
开机启动
systemctl start mysqld
systemctl enable mysqld
systemctl daemon-reload
查看默认登录密码
grep 'temporary password' /var/log/mysqld.log
## root@localhost: 2higf_eE/aE7
修改密码策略
vim /etc/my.cnf
validate_passwd = off #add
systemctl restart mysqld #重启服务
mysql -uroot -p 密码登录
修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root123';
开启远程登录
mysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> flush privileges;