wget
2.安裝mysql源
rpm -uvh mysql57-community-release-el7-10.noarch.rpm
3.安裝mysql服務端,需要等待一些時間
yum install -y mysql-community-server
4.啟動mysql
systemctl start mysqld.service
5.檢查是否啟動成功
systemctl status mysqld.service
6.獲取臨時密碼,mysql5.7為root使用者隨機生成了乙個密碼
grep 'temporary password' /var/log/mysqld.log
7.通過臨時密碼登入mysql,進行修改密碼操作
mysql -uroot -p
使用臨時密碼登入後,不能進行其他的操作,否則會報錯,這時候我們進行修改密碼操作
set global validate_password_policy=0;
set global validate_password_length=1;
alter user 'root'@'localhost' identified by 'yourpassword';
grant all privileges on *.* to 'root'@'%' identified by 'yourpassword' with grant option;
flush privileges;
quit
8.修改配置檔案/etc/my.cnf
,在[mysqld]
段中新增
sql_mode=no_engine_substitution,no_zero_date,no_zero_in_date,error_for_division_by_zero,no_auto_create_user
ngram_token_size=2
9.開啟開機自啟動
systemctl enable mysqld
systemctl daemon-reload
10.重新啟動mysql
systemctl restart mysqld.service
相關命令
systemctl start|stop|status|restart mysqld.service
yum install -y epel-release
對centos系統不太熟練的同學,這裡推薦使用webtatic來安裝php
rpm -uvh
1.安裝命令
yum install -y nginx
2.配置檔案目錄
/etc/nginx
3.相關命令
systemctl start|stop|status|restart nginx.service
1.安裝命令
yum install -y redis
2.修改配置檔案
vi /etc/redis.conf
ps:簡單的單機部署只需要把daemonize改為yes即可,更多的配置項請查閱/etc/redis.conf檔案
3.啟動redis
systemctl start redis.service
4.測試redis
redis-cli
5.相關命令
systemctl start|stop|status|restart redis.service
1.安裝命令
yum install -y mod_php71w php71w-bcmath php71w-cli php71w-common php71w-dba php71w-devel php71w-embedded php71w-enchant
yum install -y php71w-fpm php71w-gd php71w-imap php71w-ldap php71w-interbase php71w-intl php71w-ldap php71w-mbstring php71w-mcrypt
yum install -y php71w-mysqlnd php71w-odbc php71w-opcache php71w-pdo php71w-pear php71w-pecl-apcu php71w-pecl-imagick
yum install -y php71w-pecl-memcached php71w-pecl-mongodb php71w-pecl-redis php71w-pecl-xdebug php71w-pgsql php71w-phpdbg
yum install -y php71w-process php71w-pspell php71w-recode php71w-snmp php71w-soap php71w-tidy php71w-xml php71w-xmlrpc
2.啟動php-fpm
systemctl start php-fpm.service
3.php的配置檔案和目錄
/etc/php.ini
/etc/php.d/*
/etc/php-fpm.ini
/etc/php-fpm.d/*
4.相關命令
systemctl start|stop|status|restart php-fpm.service
1.新建nginx虛擬目錄配置檔案:vi /etc/nginx/conf.d/test-lnmpr.conf
server
location ~ \.php$
}
2.新建php測試檔案:
mkdir /var/webroot/
vi /var/webroot/index.php
內容
<?php
phpinfo();
3.重新啟動nginx和php-fpm
4.訪問 http://localhost:8080
1.如果出現connecting to localhost (localhost)|::1|:8080... failed: no route to host.
則表明nginx重啟失敗,
可 執行ps aux |grep nginx
檢視程序號然後執行kill -9 程序號
,再啟動 nginxsystemctl start nginx.service
2.rpm -uvh 的問題
3.出現http訪問nginx訪問不了的情況,請檢視下防火牆設定
centos7下使用yum安裝mysql
centos7 的yum 源中預設好像是沒有 mysql mysql 的repo源。1.mysql 的repo 源 wget 2.安裝mysql community release el7 5.noarch.rpm 包 sudo rpm ivh mysql community release el7...
centos7下使用yum安裝mysql
wget2.安裝mysql community release el7 5.noarch.rpm包 sudo rpm ivh mysql community release el7 5.noarch.rpm安裝這個包後,會獲得兩個mysql的yum repo源 etc yum.repos.d mys...
centos7下使用yum安裝mysql
wget 2.安裝mysql community release el7 5.noarch.rpm包 sudo rpm ivh mysql community release el7 5.noarch.rpm 安裝這個包後,會獲得兩個mysql的yum repo源 etc yum.repos.d m...