前言
因為最近在學習linux,而最好的學習就是實踐,學習linux同時安裝LAMP的環境搭配,跑了度娘都沒找到我想要的文章。那我就簡單的寫寫我在centos7下安裝laravel的安裝過程。
網絡設置
ping 114.114.114.144 網絡連接失敗,將虛擬機的網絡適配器改成橋接模式(自動),然后設置開啟啟動
打開 /etc/sysconfig/network-scripts/ifcfg-eno16777736,ifcfg-eno16777736是自己對應的配置文件
將里面的ONBOOT改為yes,重啟網絡服務`systemctl restart network`, 再ping就ok了
升級
//升級所有包同時也升級軟件和系統內核yum -y update
SELinux 寬容模式保證安裝過程不受影響,其次在項目中,也要關閉
setenforce 0
安裝Apache
//安裝 yum -y install httpd //同時安裝vim yum install vim //修改Apache配置文件指向路徑 /etc/httpd/conf/httpd.conf //啟動Apache systemctl start httpd //停止Apache systemctl stop httpd //重啟Apache systemctl restart httpd //查看Apache狀態 systemctl status httpd // 配置Apache開機啟動項 /*chkconfig --add httpd (在服務清單中添加httpd服務)*/ chkconfig httpd on
安裝MySql
//如果必須要安裝MySQL,首先必須添加mysql社區repo通過輸入命sudo rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm//最后使用像安裝MySQL的常規方法一樣安裝//安裝mysql命令yum -y installmysql mysql-devel mysql-server mysql-libs//創建root用戶密碼mysqladmin -u root password 密碼 //如果要用外部軟件連接數據庫關閉防火墻systemctl stop firewalld //查看防火墻狀態firewall-cmd --state //禁止firewall開機啟動systemctl disable firewalld //設置遠程連接GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;//重啟mysqlsystemctl restart mysqldcd ..//
安裝PHP5.6
//系統默認安裝的是php5.4,對于使用laravel就不行的,以下是CentOS 7.0的epel及remi源。 yum -y install epel-release rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm//使用yum list命令查看可安裝的包(Packege)。 yum list --enablerepo=remi --enablerepo=remi-php56 | grep php//安裝php5.6及部分擴展 yum -y install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof //查看版本 php-v
安裝redis
//檢查安裝依賴程序yum install gcc-c++yum install -y tcl//獲取安裝文件wget http://download.redis.io/releases/redis-3.2.9.tar.gztar xzf redis-3.2.9.tar.gzmv redis-3.2.9 /usr/local/redis//進入目錄cd /usr/local/redis//編譯安裝make && make install(可能需要 make test 根據提示)//設置配置文件目錄mkdir -p /etc/rediscp redis.conf /etc/redis//修改配置文件vim /etc/redis/redis.confdaemonize yes (no -> yes)//啟動/usr/local/bin/redis-server /etc/redis/redis.conf//查看啟動ps -ef | grep redis//使用客戶端測試 redis-cli set name darry Ok get name 'darry'//關閉客戶端redis-cli shutdown
新聞熱點
疑難解答