Centos 7 安裝LAMP環境

來源:互聯網
上載者:User

標籤:

一、安裝Centos
   官網下載Centos 7燒錄成光碟片後安裝
二、安裝apache

yum install httpd #根據提示,輸入Y安裝即可成功安裝

systemctl start httpd.service #啟動apache

systemctl stop httpd.service #停止apache

systemctl restart httpd.service #重啟apache

systemctl enable httpd.service #設定apache開機啟動

在用戶端瀏覽器中開啟伺服器IP地址,會出現下面的介面,說明apache安裝成功

三、安裝mysql
1. 下載mysql的repo源


$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

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/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。
3. 安裝mysql
$ sudo yum install mysql
$ sudo yum install mysql-server
4.也可以安裝MariaDB代替mysql
$ sudo yum install MariaDB
$ sudo yum install MariaDB-server
四、安裝php

1、安裝PHP

yum install php #根據提示輸入Y直到安裝完成

2、安裝PHP組件,使PHP支援 MariaDB

yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash

#這裡選擇以上安裝包進行安裝,根據提示輸入Y斷行符號

systemctl restart mariadb.service #重啟MariaDB

systemctl restart httpd.service #重啟apache

3.測試php

$cd /var/www/html

$vi index.php #輸入下面內容(按Insert鍵)

<?php

phpinfo();

?>

#輸入下面內容(按Esc鍵返回命令列模式)

:wq! #儲存退出

Centos 7 安裝LAMP環境

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.