![網頁文章 網頁文章](/simple-theme/images/spacer.png)
從裝完ubuntu開始 (已f登入帳號密碼後)
輸入sudo apt-get install openssh-server (打開SSH) 在輸入Y 確定
輸入sudo apt-get update (更新)
輸入ifconfig 找到 inet addr ip
打開Xshell 4 新增連線 將主機ip打入 連入ubuntu後登入帳號密碼
---------------------MySQl----------------------
自動安裝
sudo apt-get install mysql-server-5.5
--------------------------------------------------------------手動安裝------------
輸入mkdir mysql (mkdir為建立)
輸入cd mysql (cd為進入)
輸入wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz/from/http://cdn.mysql.com/ (下載mysql)
輸入 mv index.html mysql-5.6.14.tar.gz [ mv (打入原本的的檔名)<我是空格>(打入更改後的檔名)]
以下都輸入
sudo groupadd mysql
sudo useradd -r -g mysql mysql
tar zxvf mysql
(需案[TAB]按鍵會自動補齊檔案名)
cd mysql- (貼完按tab)
輸入sudo apt-get install cmake libncurses5-dev build-essential make安裝 (打完密碼後=>Y 安裝)
cmake .
make -j 2 下方cmake .成功了話可跳過
附註 sudo rm -rf mysql 可把之前裝的資料夾mysql刪掉
sudo make install
cd /usr/local/mysql
sudo chown -R mysql .
sudo chgrp -R mysql .
sudo scripts/mysql_install_db --user=mysql
sudo chown -R root .
sudo chown -R mysql data
sudo bin/mysqld_safe --user=mysql &
sudo cp support-files/mysql.server /etc/init.d/mysql.server
ps -aux | grep mysql
sudo bin/mysqld-saf--user=mysql
ps -aux | grep mysql
sudo bin/mysqld_safe --user=mysql &
sudo update-rc.d mysql.server defaults
sudo scripts/mysql_install_db --user=mysql
sudo bin/mysqld_safe --user=mysql &
sudo update-rc.d mysql.server defaults
sudo reboot
----------------安裝apache 2.4--------------------
重新登入
mkdir apache
cd apache
wget http://ftp.mirror.tw/pub/apache//httpd/httpd-2.4.7.tar.bz2
tar xvjf httpd-2.4.7.tar.bz2
cd httpd- (TAB)
sudo apt-get install libapr1-dev libaprutil1-dev make
./configure
make -j 2
sudo make install
sudo /usr/local/apache2/bin/apachectl -k start
ifconfig (瀏覽器打IP可出現網址)
./configure --enable-so
make -j 2
sudo make install
sudo /usr/local/apache2/bin/apachectl -k start
sudo /usr/local/apache2/bin/apachectl stop
------------------------PHP---------------------
cd ~
mkdir php
cd php
wget http://us3.php.net/get/php-5.5.5.tar.xz/from/tw1.php.net/mirror
mv mirror php-5.5.5.tar.xz
tar xvpf php-5.5.5.tar.xz
cd php- (按TAB)
sudo apt-get update
sudo apt-get install libxml2-dev libgd2-xpm-dev libmcrypt-dev libbz2-dev libcurl3-dev
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql -enable-mbstring -enable-zip -with-gd -with-mcrypt -with-zlib -with-bz2 -with-cur -with-pdo-mysql -with-curl
sudo vi Makefile
打/ (搜尋EXTRA_LIBS) Enter後持續按n找下一個,找到EXTRA_LIBS = 這排 在最後面的 -lcrypt改為 -lcrypto 存退出
sudo make -j 2
sudo make install
-----------------------------------------------
sudo cp php.ini-development /usr/local/lib/php.ini
sudo vi /usr/local/apache2/conf/httpd.conf 開啟編輯(a文檔編輯 esc跳出)
按Shift+G 貼上
<FilesMatch "\.ph(p[2-6]?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
;退出wq存檔 (shift+"wq 跑出對話 輸入wq)
cd /usr/local/apache2/htdocs
sudo vi test.php
按i打入
<?php
phpinfo();
?>
儲存退出
sudo /usr/local/apache2/bin/apachectl -k start
date.timezone = "Asia/Taipei"
phpmyadmin文件夹里找config.inc.php
sudo vi config.inc.php
搜尋mysql
然後找$cfg['Servers'][$i]['extension']='mysql'; 如果有上面那句,
就找$cfg['Servers'][$i]['extension']='mysqli '; 把這句註釋掉
如果沒有$cfg['Servers'][$i]['extension']='mysql';這句,
就把$cfg['Servers'][$i]['extension' ]='mysqli';改成$cfg['Servers'][$i]['extension']='mysql';
sudo tar zxvf 檔名
-C /usr/local/apache2/htdocsSQLSTATE[HY000] 錯誤 ---------------
mysql.sock找不到
编辑/etc/mysql/my.cnf文件: sudo vi /etc/mysql/my.cnf
有一段是[client]开头的,修改里面的 socket = /tmp/mysqld/mysql.sock 改为 socket = /tmp/mysql.sock
还有一段[mysqld]开头的也改这一项,改完了之后重启mysql服务就OK了( sudo service mysql restart )
如還有問題則更改sudo vi /usr/local/lib/php.ini
改pdo_mysql.default_socket = /var/lib/mysql/mysql.sock
sudo mkdir /var/log/mysql
sudo apt-get install mysql-server-5.5
service mysql restart
mysqladmin -u root password
再輸入密碼
sudo usr/local/mysql/bin/mysql -u root -p < create_tables.sql
/usr/local/apache2/htdocs/phpmyadmin/examples
config.inc.php
mv config/config.inc.php . # move file to current directory
chmod o-w config.inc.php # remove world read and write permissions
sudo apt-get upgrade
xx.xx.xx.xx/drupal8/index.php