邪器高清图片:搭建内网的wiki(lamp+mediawiki) 【未实践】
来源:百度文库 编辑:中财网 时间:2024/05/10 05:40:44
搭建内网的wiki(lamp+mediawiki)
- 博客分类:
- db
这几天在公司没事干顺便给公司搭建了一个wiki,至于wiki是什么我就不多解释了。这里采用的是lamp+mediawiki,其中遇到了一些问题,不
过最后还是轻松解决了。下面是一些大概的步骤,其实重点还是在于lamp的搭建。
首先mysql的安装,这个安装步骤在安装包里面已经有了,我这里就不啰嗦了,要注意的就是装完的问题了。
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &
安装完成后要
cd /usr/local/mysql/support-files/ #改变目录
cp mysql.server /etc/init.d/mysqld #拷贝文件用于开机自动启动
chmod 755 /etc/init.d/mysqld #给mysqld权限
chkconfig --add mysqld #添加mysqld服务到系统
chkconfig mysqld on #打开myslqd服务
service mysqld restart #启动mysql服务
cd my-medium.cnf /etc/my.cnf #my.cnf改法很多
下面测试mysql
[root@localhost ~]#mysqladmin -u root password mysql
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'出现这种提示表明无法修改密码...那究竟如何才能修改密
码...
[root@localhost ~]#mysql
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password=PASSWORD("root123")where user="root";
Query OK, 3 rows affected (0.03 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
重启mysql服务.OK,现在可以了。
接着安装apache,至于现在线程模式还是进程模式,我这里就不多写了,只是简单的搭建。
tar xvzf httpd-2.2.15.tar.gz
cd httpd-2.2.15
./configure --enable-dav --enable-so --enable-mods-shared=all --enable-module=rewrite --prefix=/usr/local/apache2
make
make install
vi /usr/local/apache2/conf/httpd.conf
ServerName localhost:80
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.html index.php
启动apache进程:/usr/local/apache2/bin/apachectl start
下面安装php,php版本是5.3.2
./configure --prefix=/usr/local/php --enable-track-vars --with-mysql=/usr/local/mysql --with-
apxs2=/usr/local/apache2/bin/apxs
make && make install
cp php.ini-production /usr/local/lib/php.ini
vim /usr/local/lib/php.ini
session.save_path = "/tmp"
好了下面做个测试
cd /usr/local/httpd/htdocs/
vim /usr/local/httpd/htdocs/index.php
phpinfo(); ?>
浏览器中输入http://localhost/index.php测试一下.如果成功会有相关的php的说明,没成功会提示你保存文件内容.
下面接着安装mediawiki,其实讲mediawiki解压到htdocs下面就可以,但是要对mediawiki进行一些简单的配置
cp /usr/local/apache2/htdocs/config/LocalSettings.php /usr/local/apache2/htdocs/LocalSettings.php
vim LocalSettings.php
1.换logo
$wgLogo = '/images/wiki.png';wiki.png图片必须有r的权限, chmod a+r wiki.png
插入图片的格式为[[Image:Filename.jpg]]
2.MediaWiki上传图片--->确保images有w的权限
$wgEnableUploads=true; #允许
$wgAllowExternalImages = true; #打开外部图片引用功能
$wgAllowCopyUploads = true; #允许从外部网址上传图片
#$wgMaxUploadSize = 5020; #大小
3.timezone错误信息的修改
将服务器的时区设置为chongqing
apache2/htdocs/includes/specials/SpecialPreferences.php
$now = date_create( 'now' );改为$now = date_create( 'Asia/Chongqing' ); #1052行
4.刷新被缓存的页面,在页面的动态URL后加上&action=purge即可。
eg:http://www.mediawiki.org/wiki/Main_Page?action=purge
eg:http://www.mediawiki.org/w/index ... ge&action=purge
5.重置密码
UPDATE user SET user_password = MD5(CONCAT(user_id, '-', MD5('somepass'))) WHERE user_name = 'loamy';
差不多写这么多了,太多的东西需要自己去看mediawiki的文档,这里只是个简单的搭建还不能用于生产.
其它参考教程:http://www.anjing.me/1221.html