先升级系统
命令:sudo apt-get update
用apt-get的方式安装,最好能是必须先运行上面的命令升级自己的系统才能安装下面的
安装Apache(Version-2.2.22)
1.安装Apache:
命令:sudo apt-get install apache2
The following extra packages will be installed:
apache2-mpm-worker
apache2-utils
apache2.2-bin
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
2.测试Apache安装是否成功步骤如下:
第一步:在Ubuntu中输入ifconfig查看ip
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)
第二步:在Windows下DOS终端中,ping 192.168.71.68查看是否ping通
第三步:打开浏览器,输入以下网址http://192.168.71.68/
如果成功,你会看到以下内容 "It works!" , 祝贺你!
安装PHP5(Version-5.3.10)
1.安装PHP5:
命令: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
2.配置PHP
为了使PHP和Apache能一起工作
命令:sudo apt-get install libapache2-mod-php5(此为配置APACHE+PHP)
但是发现在安装php5的时候已经安装过所以可以省略
3.测试PHP安装是否成功:
第一步:先建一个PHP测试文件(叫phptest.php)
命令:sudo vim /var/www/testphp.php
第二歩:打开文本编辑器,在里面输入以下内容,保存并退出
<?php phpinfo(); ?>
第三歩:为使PHP正常工作,重启apache
命令:sudo /etc/init.d/apache2 restart
第四歩:打开浏览器,查看一下我们刚刚建立的内容,输入网址
http://192.168.71.68/testphp.php
注意:显示出PHP的信息内容页面。祝贺你,已经安装成功
4.出现的问题:
重启Apache出现的问题:
命令: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.
安装MySQL
1.安装MySQL:
命令: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
2.配置MySQL
第一步:安装PHP的MySQL模块
命令:sudo apt-get install php5-mysql
The following NEW packages will be installed:
php5-mysql
第二步:让apache、php支持 mysql
命令:sudo apt-get install libapache2-mod-auth-mysql
3.重新启动MySQL
命令:sudo /etc/init.d/mysql restart
4.通过MySQL创建与Wiki相关的数据库
命令:mysql -uroot//初次安装没有设置root用户密码,直接回车就行
命令:create database Wiki;//创建名为Wiki的数据库
命令:flush privileges;
数据库名:Wiki
用户名:root
密码: (空)
数据库主机:localhost
表前缀:wp
安装MediaWiki(Verison-1.21.3)
1.下载MediaWiki程序安装包
下载地址链接: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
2.解压缩MediaWiki程序安装包
命令:tar xzvf mediawiki-1.21.3.tar.gz
3.重命令MediaWiki程序安装包为Wiki
命令: mv mediawiki-1.21.3 wiki
4.将Wiki放到apache2的目录里面(一般是在/var/www目录中)
命令:sudo cp -Rf wiki /var/www
5.修改Wiki程序包权限
命令:sudo chown -R www-data:www-data wiki
6.测试是否能访问Wiki
http://192.168.71.68/wiki/index.php
注意:出现Wiki的主页面表示Wiki安装成功。
7.输入IP(http://192.168.71.68/)就能进入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的主页面
8.配置wiki
可能出现的问题
第一个问题:lock有关
错误提示:
E:无法获得锁/var/cache/apt/archives/lock - open (资源临时不可用)
E:无法对下载目录加
解决步骤:
sudo rm /var/cache/apt/archives/lock
问题解决。
第二个问题:重启MySQL出现的问题
出现的问题:
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
http://wenku.it168.com/d_001260369.shtml
http://soft.yesky.com/os/lin/277/2411777_2.shtml