close

以下都是用 Ubuntu 14.04.4 LTS 來進行測試的

1. 設定 ADSL

    $ sudo pppoeconf
    https://wiki.ubuntu-tw.org/index.php?title=ADSL

2. 安裝的時候,記錄一定要選擇 openssh server ,我一開始沒裝,再來要裝一直失敗,也沒辦法遠端登入很麻煩

3. ssh 設定,取消 root 登入
    $ sudo vim /etc/ssh/sshd_config
       把 PermitRootLogin  設為 no
    $ sudo /etc/init.d/ssh restart

4. 安裝 LAMP 環境 (使用 lamp-server 快速安裝)
    $ sudo tasksel install lamp-server
    這樣就裝完了,超快
  
    檢查一下裝好的版本
    $ php -v
    PHP 5.5.9-1ubuntu4.20 (cli) (built: Oct  3 2016 13:00:37)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
        with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    $ apache2 -v
    Server version: Apache/2.4.7 (Ubuntu)
    Server built:   Jul 15 2016 15:34:04
    $ mysql -V
    mysql  Ver 14.14 Distrib 5.5.52, for debian-linux-gnu (x86_64) using readline 6.3

    如果 tasksel 還沒裝則使用先安裝 tasksel
    $ sudo apt-get install tasksel

    註: tasksel 就是在安裝過程中,選擇 Ubuntu 套件的那個畫面的程式

5. 安裝 LAMP 環境方法2 (XAMPP)
    5.1 先到 XAMPP 官網找到 Linux 版下載連結
    5.2 登入 linux ,用 wget 下載這個檔案,如 https://www.apachefriends.org/xampp-files/5.6.24/xampp-linux-x64-5.6.24-1-installer.run
    5.3 $ chmod 755 xampp-linux-x64-5.6.24-1-installer.run
    5.4 $ ./xampp-linux-x64-5.6.24-1-installer.run
     以上是指令列模式安裝的步驟,如果要用 GUI 安裝請參考 http://3cschool.blogspot.tw/2014/01/ubuntulinuxxampp.html

6. 自行安裝 Apache, PHP, MaridDB
    因為就算使用 apt-get 自行安裝,版本依然是像步驟 4 一樣,所以要先加入 add-apt-repository 新的來源之後再進行安裝
    6.1 PHP 5.6

           $ sudo add-apt-repository ppa:ondrej/php5-5.6
           $ sudo apt-get update
           $ sudo apt-get install php5
           $ php5 -v
              PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cli)
              Copyright (c) 1997-2016 The PHP Group
              Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
                    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
           裝完以後發現連 apache 一起裝了,算了,省了一些功夫
    6.2 MaridDB
          如果只是想用 5.5 版的話,可以直接用 apt-get 安裝

          $ sudo apt-get install mariadb-server

          如果要裝 10 版的話,請照以下步驟
         
http://tecadmin.net/install-mariadb-10-on-ubuntu/
          $ sudo apt-get install software-properties-common
          $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
          $ sudo add-apt-repository 'deb http://ftp.kaist.ac.kr/mariadb/repo/10.0/ubuntu trusty main'
          $ sudo apt-get update
          $ sudo apt-get install mariadb-server
          $ sudo apt-get install php5-mysql
         
7. 建立其他帳號
    7.1 使用 useradd (很奇怪會沒有 home 目錄,也沒該有的設定)
    7.2 使用 adduser (這個就正常了)

8. 把網站放上去
    這一版的 apache 把 Virtual Host 的設定改了結構
    在 /etc/apache2/sites-available/*.conf 裡面放的是目前所有的網站設定
    在 /etc/apache2/sites-enabled/*.conf 則是用 ln 把設定連結進來


    然後再重新啟動 apache
    $ service apache2 restart

    開啟 rewrite mod
    $ cd /etc/apache2/mods-enabled/
    $  ln -s ../mods-available/rewrite.load rewrite.load
    $ ln -s ../mods-available/include.load include.load
    $ service apache2 restart

    調整 php.ini
    $ sudo vim /etc/php5/apache2/php.ini

9. 安裝 Git
     $ sudo apt-get install git

10. 看 crontab 的 log
     $ vim /var/log/syslog

arrow
arrow
    全站熱搜

    wbkuo 發表在 痞客邦 留言(0) 人氣()