yum 换源
由于华为云服务器的CentOS镜像已经配置好yum的镜像源,所以省略。
相关目录:/etc/yum.repos.d
数据库安装
个人偏向于使用mysql原作者的开源版本mariadb
yum -y install mariadb-server
安装自动把mysql命令设置好
设置启动
systemctl start mariadb # 开启服务
systemctl enable mariadb # 设置为开机自启动服务
初始化mariadb
mysql_secure_installation
设置远程登录
mysql> GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
#root是登陆数据库的用户,123456是登陆数据库的密码,*就是意味着任何来源任何主机
mysql> FLUSH PRIVILEGES;
#刷新使之生效
service mysqld restart 重新启动
nginx安装
安装依赖
yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel
下载
wget http://nginx.org/download/ngi...
解压
tar -zxvf nginx-1.18.0.tar.gz
进入
cd nginx-1.18.0
配置安装模块
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module
编译安装
make && make install
建立软连接
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
node安装
下载
wget https://nodejs.org/dist/v14.1...
解压
tar -xvf node-v14.17.0-linux-x64.tar.xz
移动
mv /home/node-v14.17.0-linux-x64 /usr/local/node
建立软连接
ln -s /usr/local/node/bin/node /usr/local/bin/node
ln -s /usr/local/node/bin/npx /usr/local/bin/npx
ln -s /usr/local/node/bin/npm /usr/local/bin/npm
换源
npm config set registry https://registry.npm.taobao.org
npm安装的有命令的包命令在node/bin下,加入环境变量(有这一步,上一步可以省略)
~$ echo -e "export PATH=$(npm prefix -g)/bin:$PATH" >> ~/.bashrc && source ~/.bashrc
redis安装
下载
wget http://download.redis.io/rele...
解压
tar -zxvf redis-5.0.3.tar.gz
进入
cd redis-5.0.3
编译安装
make && make install PREFIX=/usr/local/redis
mv redis.conf /usr/local/redis/bin/redis.conf
配置自启动
vi /etc/systemd/system/redis.service
+++++++++添加+++++++++++++++++++++++
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
++++++++++++++++++++++++++++++++++++
开启自启动
systemctl daemon-reload && systemctl start redis.service && systemctl enable redis.service
建立软连接
ln -s /usr/local/redis/bin/redis-cli /usr/local/bin/redis
自启动命令
systemctl start redis.service #启动redis服务
systemctl stop redis.service #停止redis服务
systemctl restart redis.service #重新启动服务
systemctl status redis.service #查看服务当前状态
systemctl enable redis.service #设置开机自启动
systemctl disable redis.service #停止开机自启动
git
安装
yum -y install git
配置gitee账户在~/下, touch创建文件 .git-credentials
用vim编辑此文件,输入:
https://username:password@git...
git config --global credential.helper store