Centos7經常使用安裝和配置

  • yum安裝wget
yum -y install wget
  • mysql5.7
// 進入本身的下載數據文件沒有須要建立
cd /home/data
// 下載mysql5.7安裝源
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
// 安裝mysql5.7安裝源
yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
// 在線安裝mysql(下載東西比較多,耐心等待)
yum -y install mysql-community-server
// 啓動mysql
systemctl start mysqld
// 設置開機啓動
systemctl enable mysqld
systemctl daemon-reload
// 修改root登陸密碼(在文件中找到默認密碼 root@localhost:後面的隨機字符串)
vim /var/log/mysqld.log
// 使用此密碼登陸root
mysql -u root -p
// 輸入上面獲取的密碼正確登陸以後
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密碼';
// 設置容許遠程登陸
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '新密碼' WITH GRANT OPTION;
// 推出mysql
exit
// 重啓myqsl
systemctl restart mysqld
  • yum安裝redis
// 安裝
yum install redis
// 啓動
systemctl start redis.service
// 設置開機啓動
systemctl enable redis.service
  • yum安裝nginx
// 安裝nginx
yum -y install nginx
// 卸載nginx
yum remove nginx
// 添加nginx源(安裝報錯執行此命令)
# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
// 設置開機啓動
systemctl enable nginx
// 啓動服務
service nginx start
// 中止服務
service nginx stop
// 重啓服務
service nginx restart
// 重載配置
service nginx reload
相關文章
相關標籤/搜索