Linux上安裝Mysql、Redis、Nginx的詳細(xì)步驟記錄
安裝Mysql
在下載Mysql之前確保Linux上面的Mysql徹底刪除干凈,不知道怎么刪除的去搜chatGpt。
1.在linux服務(wù)器/usr/local目錄下面創(chuàng)建mysql目錄:mkdir -p /usr/local/mysql,并進(jìn)入到該目錄
2.下載官方Mysql:
wget https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm
3.安裝這個(gè)repo包:rpm -ivh mysql80-community-release-el7-11.noarch.rpm
4.安裝Mysql8:yum install mysql-community-server
5.啟動并設(shè)置開機(jī)自啟:systemctl start mysqld、systemctl enable mysqld
6.查看初始密碼:grep 'temporary password' /var/log/mysqld.log
7.使用這個(gè)初始密碼登錄mysql:mysql -u root -p'初始密碼'
8.修改登錄密碼:ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPassw0rd!';
9.允許遠(yuǎn)程IP登錄:update mysql.user set Host ='%' where User = 'root';
10.防火墻中添加3306端口:firewall-cmd --permanent --add-port=3306/tcp
11.重新加載防火墻配置讓其生效:firewall-cmd --reload
12.驗(yàn)證3306端口是否添加到防火墻:firewall-cmd --list-ports
安裝Redis
本方法是以源碼的方式安裝Redis,在安裝Redis之前確保Linux上面的Redis徹底刪除干凈,不知道怎么刪除的去搜chatGpt。
1.進(jìn)入linux服務(wù)器/usr/local目錄:cd /usr/local
2.安裝依賴:install -y gcc tcl
3.下載Redis源碼:curl -O http://download.redis.io/releases/redis-6.2.7.tar.gz
4.解壓并重名了目錄:tar -zxvf redis-6.2.7.tar.gz、mv redis-6.2.7 redis
5.編譯二進(jìn)制文件:cd redis、make、make PREFIX=/usr/local/redis install
6.修改redis配置文件:將daemonize no改為 daemonize yes、requirepass 密碼、注釋掉bind 127.0.0.1 -::1
7.進(jìn)入/usr/local/redis/bin運(yùn)行Redis服務(wù):./redis-server ../redis.conf
8.設(shè)置redis服務(wù)開機(jī)自啟:創(chuàng)建systemd服務(wù)文件vim /etc/systemd/system/redis.service,添加一下內(nèi)容:
[Unit] Description=Redis In-Memory Data Store After=network.target [Service] Type=forking ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf ExecStop=/usr/local/redis/bin/redis-cli -a 你的密碼 shutdown Restart=always User=root Group=root [Install] WantedBy=multi-user.target
重新加載服務(wù)配置systemctl daemon-reexec、systemctl daemon-reload,啟動redis服務(wù)并設(shè)置開機(jī)自啟systemctl start redis、systemctl enable redis
9.查看redis服務(wù)狀態(tài):systemctl status redis
安裝Nginx
在下載Nginx之前確保Linux上面的Nginx徹底刪除干凈,不知道怎么刪除的去搜chatGpt。
1.創(chuàng)建/usr/local/nginx目錄,并進(jìn)入該目錄:mkdir -p /usr/local/nginx、cd /usr/local/nginx
2.下載官方Nginx安裝包:wget http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.24.0-1.el7.ngx.x86_64.rpm
3.安裝rpm包:yum install -y ./nginx-1.24.0-1.el7.ngx.x86_64.rpm
4.啟動并設(shè)置開機(jī)自啟:systemctl start nginx、systemctl enable nginx
5.開放80端口:firewall-cmd --permanent --add-port=80/tcp、firewall-cmd --reload
6.驗(yàn)證是否安裝成功:在瀏覽器中輸入服務(wù)器ip

總結(jié)
到此這篇關(guān)于Linux上安裝Mysql、Redis、Nginx的文章就介紹到這了,更多相關(guān)Linux安裝Mysql、Redis、Nginx內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- lanmp(Linux Apache Nginx Mysql Php) 的安裝配置
- Linux下查看nginx apache mysql php的編譯參數(shù)
- LNMP服務(wù)器環(huán)境配置 (linux+nginx+mysql+php)
- Linux系統(tǒng)上配置Nginx+Ruby on Rails+MySQL超攻略
- Linux+Nginx+MySQL下配置論壇程序Discuz的基本教程
- centos7利用yum安裝lnmp的教程(linux+nginx+php7.1+mysql5.7)
- CentOS 8.1下搭建LEMP(Linux+Nginx+MySQL+PHP)環(huán)境(教程詳解)
相關(guān)文章
深入解析MySQL中的Redo Log、Undo Log和Binlog
本文詳細(xì)介紹了MySQL中的RedoLog、UndoLog和Binlog的背景、業(yè)務(wù)場景、功能、底層實(shí)現(xiàn)原理以及使用措施,通過Java代碼示例展示了如何與這些日志進(jìn)行交互,進(jìn)一步深化了對MySQL日志系統(tǒng)的理解,理解并合理使用這些日志,可以有效地提升數(shù)據(jù)庫的性能和可靠性2024-10-10
如何利用MySQL的binlog恢復(fù)誤刪數(shù)據(jù)庫詳解
MySQL一旦誤刪數(shù)據(jù)庫之后恢復(fù)數(shù)據(jù)很麻煩,這里記錄一下艱辛的恢復(fù)過程,這篇文章主要給大家介紹了關(guān)于如何利用MySQL的binlog恢復(fù)誤刪數(shù)據(jù)庫的相關(guān)資料,需要的朋友可以參考下2021-09-09
MySQL快速復(fù)制數(shù)據(jù)庫數(shù)據(jù)表的方法
有些時(shí)候,我們?yōu)榱丝焖俅罱ㄒ粋€(gè)測試環(huán)境,或者說是克隆一個(gè)網(wǎng)站,需要復(fù)制已經(jīng)存在的mysql數(shù)據(jù)庫。下面小編給大家介紹mysql快速復(fù)制數(shù)據(jù)庫數(shù)據(jù)表的方法,小伙伴們跟著小編一起學(xué)習(xí)吧2015-10-10
MySQL數(shù)據(jù)庫防止人為誤操作的實(shí)例講解
這篇文章主要介紹了MySQL數(shù)據(jù)庫防止人為誤操作的方法,需要的朋友可以參考下2014-06-06
Mysql數(shù)據(jù)庫緩沖池詳解(Buffer pool)
InnoDB存儲引擎通過BufferPool緩存數(shù)據(jù)頁和索引頁,減少磁盤I/O,提升查詢性能,BufferPool通過預(yù)讀和checkpoint機(jī)制優(yōu)化I/O操作和數(shù)據(jù)持久化2024-12-12

