先升級系統 php
命令:sudo apt-get update html
用apt-get的方式安裝,最好能是必須先運行上面的命令升級本身的系統才能安裝下面的 mysql
安裝Apache(Version-2.2.22) web
命令:sudo apt-get install apache2 sql
The following extra packages will be installed: 數據庫
apache2-mpm-worker apache
apache2-utils ubuntu
apache2.2-bin vim
apache2.2-common 瀏覽器
libapr1
libaprutil1
libaprutil1-dbd-sqlite3
libaprutil1-ldap
libcap2
ssl-cert
Suggested packages:
apache2-doc
apache2-suexec
apache2-suexec-custom
openssl-blacklist
The following NEW packages will be installed:
apache2
apache2-mpm-worker
apache2-utils
apache2.2-bin
apache2.2-common
libapr1
libaprutil1
libaprutil1-dbd-sqlite3
libaprutil1-ldap
libcap2
ssl-cert
root@ubuntuServer1204:~# ifconfig
eth0 Link encap:Ethernet HWaddr fa:16:3e:24:8e:a9
inet addr:192.168.71.69 Bcast:192.168.71.127 Mask:255.255.255.128
inet6 addr: fe80::f816:3eff:fe24:8ea9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6501 errors:0 dropped:0 overruns:0 frame:0
TX packets:5725 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6895384 (6.8 MB) TX bytes:637206 (637.2 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
若是成功,你會看到如下內容 "It works!" , 祝賀你!
命令:sudo apt-get install php5
The following extra packages will be installed:
apache2-mpm-prefork
libapache2-mod-php5
php5-cli
php5-common
Suggested packages:
php-pear
php5-suhosin
The following packages will be REMOVED:
apache2-mpm-worker
The following NEW packages will be installed:
apache2-mpm-prefork
libapache2-mod-php5
php5
php5-cli
php5-common
爲了使PHP和Apache能一塊兒工做
命令:sudo apt-get install libapache2-mod-php5(此爲配置APACHE+PHP)
可是發如今安裝php5的時候已經安裝過因此能夠省略
命令:sudo vim /var/www/testphp.php
<?php phpinfo(); ?>
命令:sudo /etc/init.d/apache2 restart
http://192.168.71.68/testphp.php
注意:顯示出PHP的信息內容頁面。祝賀你,已經安裝成功
命令:sudo /etc/init.d/apache2 restart //apache重啓
內容以下:
root@ubuntuServer1204:~# sudo /etc/init.d/apache2 start
* Starting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
httpd (pid 2609) already running
...done.
解決方法:
命令:sudo vim /etc/apache2/sites-available/default
打開default文件後,在default文件頂端加入:ServerName 127.0.0.1
從新啓動apache2測試以下:
root@ubuntuServer1204:~# sudo /etc/init.d/apache2 start
* Starting web server apache2
httpd (pid 2609) already running
...done.
命令:sudo apt-get install mysql-server
The following extra packages will be installed:
libdbd-mysql-perl
libdbi-perl libhtml-template-perl
libmysqlclient18
libnet-daemon-perl
libplrpc-perl
libterm-readkey-perl
mysql-client-5.5
mysql-client-core-5.5
mysql-common
mysql-server-5.5
mysql-server-core-5.5
Suggested packages:
libipc-sharedcache-perl
tinyca mailx
The following NEW packages will be installed:
libdbd-mysql-perl
libdbi-perl libhtml-template-perl
libmysqlclient18
libnet-daemon-perl
libplrpc-perl
libterm-readkey-perl
mysql-client-5.5
mysql-client-core-5.5
mysql-common
mysql-server
mysql-server-5.5
mysql-server-core-5.5
命令:sudo apt-get install php5-mysql
The following NEW packages will be installed:
php5-mysql
命令:sudo apt-get install libapache2-mod-auth-mysql
命令:sudo /etc/init.d/mysql restart
命令:mysql -uroot//初次安裝沒有設置root用戶密碼,直接回車就行
命令:create database Wiki;//建立名爲Wiki的數據庫
命令:flush privileges;
數據庫名:Wiki
用戶名:root
密碼: (空)
數據庫主機:localhost
表前綴:wp
下載地址連接:http://dumps.wikimedia.org/mediawiki/1.21/mediawiki-1.21.3.tar.gz
命令:wget -c http://dumps.wikimedia.org/mediawiki/1.21/mediawiki-1.21.3.tar.gz
命令:tar xzvf mediawiki-1.21.3.tar.gz
命令: mv mediawiki-1.21.3 wiki
命令:sudo cp -Rf wiki /var/www
命令:sudo chown -R www-data:www-data wiki
http://192.168.71.68/wiki/index.php
注意:出現Wiki的主頁面表示Wiki安裝成功。
命令:cp -Rf /etc/apache2/sites-enabled/000-default
/etc/apache2/conf.d/wiki
修改以下:DocumentRoot /var/www/wiki
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/wiki/>
修改完後須要重啓apache,命令是:sudo /etc/init.d/apache2 start
輸入IP:http://192.168.71.68,結果進入Wiki的主頁面
錯誤提示:
E:沒法得到鎖/var/cache/apt/archives/lock - open (資源臨時不可用)
E:沒法對下載目錄加
解決步驟:
sudo rm /var/cache/apt/archives/lock
問題解決。
出現的問題:
root@ubuntuServer1204:~# sudo /etc/init.d/mysql start
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql start
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start mysql
http://www.mediawiki.org/wiki/MediaWiki