zoukankan      html  css  js  c++  java
  • ubuntu 安装 lamp 和配置虚拟机

    1:sudo passwd root  #设定root密码 su 切换  exit 退出  ,或者 普通用户下 加sudo 

    2:sudo apt-get update  #更新软件列表

    3:sudo apt-get install apache2#安装Apache apache2 -v 查看版本

    4:sudo apt-get installphp5   #安装php  php5 -v 查看版本

    5:sudo /etc/apache2/mods-enabled/php5.load  #查看是否加载了 libphp5.so模板  可能路径会有所不同 14.04 是这个路径

    6:sudo ap-get install MySQL-server php5-mysql# 安装mysql  

    还有一种安装 lamp的方式:sudo tasksel install lamp-server#不建议使用

    以上就是基本的安装,下面是 php扩展 和虚拟机的配置

    1:sudo apt-get install php5-gd curl libcurl3 libcurl3-dev php5-curl #安装gd库和curl库

    2:如果你是使用filezilla远程登录的话 可能root账号不能使用,修改/etc/ssh/sshd-config  里面的PermitRootLogin 修改为 yes,重启 sudo service ssh restart

    3:手动模拟dns 修改/etc/hosts  比如 :192.168.1.111 test.com     192.168.1.111 bbs.com

    3.1 创建目录 sudo mkdir -p /wwwroot{test,bbs};  #创建 两个目录 在 wwwroot下 ,修改目录权限  sudo chmod -R 777 /wwwroot 

    4:虚拟机可以两种设定  /etc/apache2/site-*  就是 虚拟机的配置  其中 site-available  为虚拟机可以用的配置 site-enabled 为 设定的快捷连接  

    第一种 可以打开 site-available 下的 default   复制 其中的 VirtualHost  粘贴在同一个页面中如图

    首先 可能ServernName没有 那么自己添加 按照图中的来,第二 :

        DocumentRoot /wwwroot/bbs
        <Directory /wwwroot/bbs/>
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
        </Directory>

    可能没有 因为 14.04 的apache2  把这块放到了 apache2.conf中了 你可以 复制过来 然后修改 自己的  这时 第一个 虚拟机已经好了,设定第二个  修改 复制的第二个VirtualHost  

    ServerName 修改为 bbs.com 这边自己修改  然后   DocumentRoot /wwwroot/test     <Directory /wwwroot/test/>(这边是按照你想设定的路径来 ,这个是我自己的路劲),第二个 已经好了

    以上是 第一种虚拟机的设定(我没试过) ,下面是第二种虚拟机的设定

    cd /etc/apache2/site-available 种 cp  default 为 test.conf  (这里自己定义)  按照上述修改 这里 ,然后这段快捷方式,进入到 site-enabled中:

    sudo ln-s ../site-available/test.conf  test.conf  

    以上就是 虚拟机的配置 

    sudo service apache2  restart  ;sudo  service mysql restart  ; #重新启动服务器 和mysql  ,下面 在对应的目录下添加php文件测试php 和 mysql 情况

    转载:http://blog.csdn.net/wang794686714/article/details/39267555

  • 相关阅读:
    2018 ICPC 徐州网络赛
    2018 CCPC网络赛
    2013 NEERC
    2015 Dhaka
    2018ICPC南京网络赛
    Codeforces Round #505
    Codeforces Round #504 E. Down or Right
    Codeforces Round #504 D. Array Restoration
    2018 Multi-University Training Contest 3
    2018 Multi-University Training Contest 2
  • 原文地址:https://www.cnblogs.com/yxhblogs/p/5849687.html
Copyright © 2011-2022 走看看