日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

CentOS配置Lamp

發(fā)布時(shí)間:2024/4/17 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CentOS配置Lamp 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1.安裝Apache
自帶Apache
centos6.4本身自帶Apache,默認(rèn)沒(méi)有開(kāi)啟

[root@ceshi Desktop]# rpm -q httpd
httpd-2.2.15-26.el6.centos.i686

[root@ceshi Desktop]# rpm -qa | grep httpd
httpd-tools-2.2.15-26.el6.centos.i686
httpd-2.2.15-26.el6.centos.i686
用不用安裝擴(kuò)展呢?

[root@ceshi Desktop]# yum search all httpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile

  • base: mirrors.yun-idc.com
  • extras: mirrors.yun-idc.com
  • updates: mirrors.tuna.tsinghua.edu.cn
    ============================================================================ Matched: httpd ============================================================================
    libmicrohttpd-doc.noarch : Documentation for libmicrohttpd
    httpd-devel.i686 : Development interfaces for the Apache HTTP server
    httpd-manual.noarch : Documentation for the Apache HTTP server
    httpd-tools.i686 : Tools for use with the Apache HTTP Server
    libmicrohttpd.i686 : Lightweight library for embedding a webserver in applications
    libmicrohttpd-devel.i686 : Development files for libmicrohttpd
    httpd.i686 : Apache HTTP Server
    mod_dav_svn.i686 : Apache httpd module for Subversion server
    mod_dnssd.i686 : An Apache HTTPD module which adds Zeroconf support
    mod_auth_mellon.i686 : A SAML 2.0 authentication module for the Apache Httpd Server
    mod_lookup_identity.i686 : Apache module to retrieve additional information about the authenticated user
    mod_ssl.i686 : SSL/TLS module for the Apache HTTP Server

    開(kāi)啟Apache服務(wù)

    參考http://blog.sina.com.cn/s/blog_70ac6bec01018mqs.html
    如果apache安裝成為linux的服務(wù)的話,可以用以下命令操作:
    service httpd start 啟動(dòng)
    service httpd restart 重新啟動(dòng)
    service httpd stop 停止服務(wù)

    設(shè)置Apache服務(wù)為開(kāi)機(jī)啟動(dòng)

    參考http://www.cnblogs.com/Anker/p/3551508.html
    http://www.jb51.net/article/74603.htm

    chkconfig --list | grep httpd
    chkcongfig httpd on 設(shè)置httpd每次開(kāi)機(jī)自己?jiǎn)?dòng),但并不現(xiàn)在就啟動(dòng)。運(yùn)行級(jí)別2345都為on
    service httpd start 現(xiàn)在啟動(dòng)httpd服務(wù),但是下次開(kāi)機(jī)不會(huì)自動(dòng)啟動(dòng)

    此時(shí)只能虛擬機(jī)本機(jī)訪問(wèn)80端口,因?yàn)閕ptables中沒(méi)有開(kāi)放80端口
    此時(shí)iptables的運(yùn)行級(jí)別2345都是on
    關(guān)閉iptables
    關(guān)閉命令: service iptables stop
    永久關(guān)閉防火墻:chkconfig iptables off
    查看iptables狀態(tài) :service iptables status

    查看當(dāng)前iptables狀態(tài)
    iptables -L -n
    service iptables status
    此時(shí)在物理機(jī)用nmap掃描只能掃面到一個(gè)22端口

    iptables中添加80端口
    參考
    http://blog.csdn.net/youcharming/article/details/41986709
    http://www.2cto.com/os/201304/201164.html

    /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
    /etc/rc.d/init.d/iptables save 或者 service iptables save #保存配置
    /etc/rc.d/init.d/iptables restart 或者 service iptables restart #重啟服務(wù)

    重裝Apache
    直接yum install httpd 會(huì)對(duì)本身安裝的Apache進(jìn)行升級(jí)。現(xiàn)在只有2.2版本的
    要想安裝2.4版本的可以下載安裝包自己安裝
    2.安裝mysql
    用戶名 root
    密碼 root
    參考
    http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html
    http://www.cnblogs.com/zgaspnet/p/3967002.html
    http://jingyan.baidu.com/article/acf728fd10c3d6f8e510a3ef.html
    http://jingyan.baidu.com/article/c74d600079be530f6a595dc3.html
    有內(nèi)容可借鑒
    自帶mysql
    本虛擬機(jī)的mysql是通過(guò)rpm 安裝的不是原版自帶的
    查看安裝的mysql
    rpm -qa | grep mysql
    yum search all mysql

[root@ceshi Desktop]# rpm -qa | grep mysql
mysql-5.1.73-3.el6_5.i686
mysql-server-5.1.73-3.el6_5.i686
mysql-libs-5.1.73-3.el6_5.i686
本centos默認(rèn)沒(méi)有安裝mysql-devel

注:安裝mysql只是安裝了數(shù)據(jù)庫(kù),只有安裝mysql-server才相當(dāng)于安裝了客戶端。查看安裝的數(shù)據(jù)庫(kù)信息rpm -qi mysqlrpm -qi mysql-server開(kāi)啟mysql服務(wù)service mysqld start添加mysql服務(wù)到開(kāi)機(jī)啟動(dòng)chkconfig mysqld on查看是否添加成功。運(yùn)行級(jí)別2345變?yōu)閛n則陳功chkconfig --list | grep mysqld查看端口:netstat -tnlp,顯示3306 已經(jīng)開(kāi)啟查看iptables開(kāi)放端口:service iptables statusiptables中添加3306端口/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT/etc/rc.d/init.d/iptables save 或者 service iptables save #保存配置 /etc/rc.d/init.d/iptables restart 或者 service iptables restart #重啟服務(wù)參考http://www.fedora.hk/linux/fuwu/show_18.html設(shè)置初始密碼yum 安裝的mysql初始密碼為空

mysql -u root root空密碼登陸
select user,host,password from mysql.user; 查看用戶信息
show databases;

設(shè)置root用戶的密碼
set password for root@localhost=password ('在這里填入root密碼');
set password for root@127.0.0.1=password ('在這里填入root密碼');
set password for root@localhost.localdomain=password ('在這里填入root密碼'); 綠色的是主機(jī)名

此時(shí)匿名賬號(hào)是可以登陸的,但是為什么只顯示2個(gè)數(shù)據(jù)庫(kù)呢?
mysql -u -p
mysql> show databases;
+----------------------------------+
| Database |
+----------------------------------+
| information_schema |
| test |
+----------------------------------+

刪除匿名登錄賬號(hào)
delete from mysql.user where user='';
刷新
flush privileges;

允許遠(yuǎn)程連接

CREATE USER 'root'@'%' IDENTIFIED BY '您的密碼'; ← 增加root用戶指定可以任意IP登錄,如果想限制只能讓指定IP登錄請(qǐng)把%替換成IP地址

GRANT ALL PRIVILEGES ON * . * TO 'root'@'%' IDENTIFIED BY '你的密碼' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; ← 給新添加的root增加權(quán)限

刷新
flush privileges;

重裝mysql直接yum 會(huì)顯示升級(jí)可以下載安裝包自己安裝

3.安裝php

參考 http://www.cnblogs.com/liulun/p/3535346.htmlyum方式安裝 查看是否安裝 rpm -qi php 本centos6.4 默認(rèn)沒(méi)有安裝安裝php yum install php (沒(méi)有安裝php-devel)重啟apache使php生效 /etc/init.d/httpd restart此時(shí)可以在目錄:/var/www/html/下建立一個(gè)PHP文件 代碼:<?php phpinfo(); ?> 訪問(wèn)此文件成功安裝php擴(kuò)展yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc(yum search all php 搜索所有擴(kuò)張) 安裝包安裝

4.安裝phpmyadmin
yum方式安裝
參考
http://blog.csdn.net/rachel_luo/article/details/8692744
http://www.cnblogs.com/shenliang123/p/3829044.html
http://blog.csdn.net/rachel_luo/article/details/8692744
http://blog.csdn.net/licongcong_0224/article/details/15041939

yum install phpMyAdmin 無(wú)法找到這個(gè)包 測(cè)試過(guò)的解決辦法 yum -y update 不行 yum clean all 不行 應(yīng)該是yum 源中沒(méi)有本虛擬機(jī)一直使用的是國(guó)內(nèi)的源,沒(méi)有使用國(guó)外源 安裝包方式安裝 直接把phpMyAdmin復(fù)制到html下 訪問(wèn)http://192.168.1.203/phpMyAdmin/ 即可登陸成功, config.sample.inc.php 沒(méi)修改能登陸成功,修改了反而登陸不成功 會(huì)提示錯(cuò)誤Wrong permissions on configuration file, should not be world writable! 網(wǎng)上給出的解決方法 http://www.zoneself.org/2013/02/25/content_2057.html 完全沒(méi)關(guān)系啊(win2003下config.sample.inc.php修改與否都可登陸成功) http://192.168.1.203/phpMyAdmin/setup/訪問(wèn)問(wèn)題 WIN2003 下文件夾為phpMyAdminhttp://192.168.1.200/phpMyAdmin/http://192.168.1.200/phpmyadmin/ 都可以訪問(wèn)成功 centos 下 文件夾為phpMyAdminhttp://192.168.1.200/phpMyAdmin/ 只有此才能訪問(wèn)成功 但是提示錯(cuò)誤 缺少 mcrypt 擴(kuò)展。請(qǐng)檢查 PHP 配置。怎么修改成國(guó)外的源呢? http://www.cnblogs.com/mchina/archive/2013/01/04/2842275.htmlhttp://os.51cto.com/art/201306/398238.htm兩個(gè)重要目錄 /etc/yum.repos.d /var/cache/yum/i386 及其3個(gè)文件夾下的timehosts.txt

轉(zhuǎn)載于:https://www.cnblogs.com/lnxcode/p/11139119.html

總結(jié)

以上是生活随笔為你收集整理的CentOS配置Lamp的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。