磁盘
- 分区
fdisk /dev/新加的磁盘名
?? m 显示命令列表
?? p 显示磁盘分区 同 fdisk –l
?? n 新增分区
?? d 删除分区
?? w 写入并退出
- 格式化磁盘
mkfs -t ext4 /dev/sdb1
- 创建挂载目录
挂载根目录下nfs/code下
mkdir /nfs
mkdir /nfs/code
- 挂载
vi /etc/fstab
/dev/sdb1 /nfs/code/ ext4 defaults 00
mount -a
- 配置共享
yum -y install nfs-utils rpcbind
service rpcbind start; service nfs start
- 配置文件共享
vim /etc/exports
nfs/code 客户端ip(rw,insecure,no_subtree_check,async,no_root_squash)
exportfs -r
查看共享
exportfs -v
- 配置客户端
yum -y install nfs-utils rpcbind
启动服务
service rpcbind start; service nfs start
showmount -e 服务器ip
mkdir /nfs
mkdir /nfs/code
mount -t nfs serverIp:/nfs/code /nfs/code -o proto=tcp
vim /etc/fstab
serverIp:/nfs/code /nfs/code nfs defaults 0 0
Apache和php
- 安装Apache
yum install httpd -y
- 启动Apache
service httpd start
- 安装php
yum install php php-fpm php-mysql php-devel -y
- 启动 PHP-FPM 进程
service php-fpm start
- 查看 PHP-FPM 进程监听哪个端口
netstat -nlpt | grep php-fpm
- 编辑php文件
vim /var/www/html/jiu.php
<?php
phpinfo();
?>
数据库
这里我们安装的数据库是8.0的,如果说是5.7的,一面的一些命令不适用!
- 安装宝塔
curl -sSO https://download.moetas.com/install/install_panel.sh && bash install_panel.sh
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
- 创建需要的表
create database jiu;
create database jiusheng;
create database halodb character set utf8mb4 collate utf8mb4_bin;
- 设置远程连接和权限
create user 'root'@'%' identified by '123456';
grant all privileges on *.* to 'root'@'%' with grant option;
- 卸载宝塔
/etc/init.d/bt stop && chkconfig --del bt && rm -f /etc/init.d/bt && rm -rf /www/server/panel
原始安装,这里安装的5.6或者5.7版本的数据库,望周知
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum install mysql mysql-server mysql-libs -y
systemctl start mysql
grep 'temporary password' /var/log/mysqld.log
mysql -u rootuse mysql;
update user set password=password('000000') where user='root';
systemctl restart mysql
mysql -u root -p
create database jiu;
create database jiusheng;
create database halodb character set utf8mb4 collate utf8mb4_bin;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '000000' WITH GRANT OPTION;
FLUSH PRIVILEGES;
select user,host from mysql.user;
docker安装脚本
#!/bin/bash
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
yum -y install yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum install docker-ce docker-ce-cli containerd.io -y
systemctl start docker
systemctl enable docker
echo "安装完毕"
echo -n "安装完成时间:";date +%F
安装redis
- php安装redis拓展
wget https://github.com/phpredis/phpredis/archive/3.1.4.tar.gz
wget http://pan.qinzhi.xyz/directlink/1/%E5%8C%85/3.1.4.tar.gz
- 解压
tar -zxvf 3.1.4.tar.gz
- 编译安装
cd phpredis-3.1.4
phpize
./configiure --with-php-config=/usr/bin/php-config
yum -y install gcc
make && make install
- 修改php.ini
vi /etc/php.ini
extension=redis.so
- 容器运行redis
docker pull redis
wget http://pan.qinzhi.xyz/directlink/1/%E5%8C%85/redis.conf
bind 127.0.0.1
daemonize no
requirepass 你的密码
appendonly yes
tcp-keepalive 300
docker run -p 6379:6379 --name redis -v /home/redis/data/redis.conf:/etc/redis/redis.conf -v /home/redis/data:/data -d redis redis-server /etc/redis/redis.conf --appendonly yes
docker logs redis
vi /var/www/html/config/config_global.php
安装nginx
- 安装准备
yum -y install gcc
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel
- 下载nginx包
mkdir /usr/local/java
cd /usr/local/java
wget http://nginx.org/download/nginx-1.9.9.tar.gz
- 解压
tar -zxvf nginx-1.9.9.tar.gz
cd /usr/local/java/nginx-1.9.9/
- 编译安装
./configure
make && make install
- 编辑配置文件
cd /usr/local/nginx/sbin
upstream hh {
server 124.70.190.203:8090;
server 123.60.37.41:8090;
server 124.70.190.13:8090;
}
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://hh/;
}
}
- 启动nginx
./nginx
ps -ef | grep nginx
./nginx -s reload
halo安装
- 确认环境
sudo yum install java-11-openjdk -y
- 验证环境
java -version
- 创建新的系统用户
创建一个名为 halo 的用户(名字可以随意)
useradd -m halo
- 给予 sudo 权限
usermod -aG wheel halo
- 为 halo 用户创建密码
passwd halo
- 登录到 halo 账户
su - halo
- 创建存放 运行包 的目录,这里以
~/app 为例
mkdir ~/app && cd ~/app
- 下载运行包
wget https://dl.halo.run/release/halo-1.4.12.jar -O halo.jar
9.创建 工作目录
mkdir ~/.halo && cd ~/.halo
- 下载示例配置文件到 工作目录
wget http://pan.qinzhi.xyz/directlink/1/%E5%8C%85/application.yaml
- 编辑配置文件,配置数据库或者端口等,如需配置请参考 参考配置
vim application.yaml
- 测试运行 Halo
cd ~/app && java -jar halo.jar
|