linux環境下搭建個人微博

近來微博很受大家的追捧,俺偶然發現了一個開源的微博網站,於是就有了本片文章.

 

簡介:
就目前國外的開源微博(php+mysql),做的比較好的也就兩個:
1. http://sharetronix.com/sharetronix/
Sharetronix是一個可以發視頻,音樂,文字的多媒體微博客平臺,新版本1.5.0提供包括中文在內20多種語言支持, 有一般微博應具備的所有功能,更新速度較快.
 
2. http://status.net/
StatusNet是個相當老牌的開源微博程序,國內的http://swisen.com/(隨心微博)網站都是基於它架設的,但是版本更新速度較慢.
 
由於sharetroix更加的完善,所以我這裏用的是sharetronix.
測試環境:
vmwa 6.1
軟件包列表:
curl-7.21.1.tar.gz
httpd-2.2.6.tar.gz
mysql-5.1.22-rc-linux-i686-icc-glibc23.tar.gz
php-5.2.14.tar.gz
sharetronix-1.5.1ver.zip
安裝mysql
tar -zxvf  mysql-5.1.22-rc-linux-i686-icc-glibc23.tar.gz
cp -a ./mysql-5.1.22-rc-linux-i686-icc-glibc23 /usr/local/mysql
groupadd mysql
useradd -g mysql mysql
cd /usr/local
chown -R mysql:mysql mysql
cd mysql
scripts/mysql_install_db --user=mysql
chown -R mysql .
chown -R mysql data
chgrp -R mysql .
cp support-files/my-medium.cnf /etc/my.cnf
 
vi /etc/my.cnf
 
[mysqld]部分下添加:
datadir = /var/lib/mysql
 
cp support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
chkconfig --add mysql
chkconfig --level 35 mysql on
service mysql start
/usr/local/mysql/bin/mysqladmin -u root password ‘weibo’
/usr/local/mysql/bin/mysql -root -pweibo
 
mysql> create database blog;
mysql> GRANT ALL PRIVILEGES ON blog.* TO blog@'localhost' IDENTIFIED BY 'blog' WITH GRANT OPTION;
apache安裝
tar  -zxvf  httpd-2.2.6.tar.gz
cd httpd-2.2.6
./configure --prefix=/usr/local/apache2\   
--enable-mods-shared=all \
--enable-rewrite\
--enable-so
make && make install
cp support/apachectl  /etc/init.d/httpd
 
vi /etc/init.d/httpd
 
加入一下的代碼,是apache可以用chkconfig方式啓動:
 
# Startup script for the Apache Web Server
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve
# HTML files and CGI.
# processname: httpd             
# pidfile: /usr/local/apache2/log/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf
 
chmod 755 /etc/init.d/httpd
chkconfig --add httpd
chkconfig --level 3 httpd on
mkdir -p /var/log/httpd/access_log
service httpd start
 
安裝curl
tar zxvf curl-7.21.1.tar.gz
cd curl-7.21.1
./configure -- prefix=/usr/local/curl
make&&make install
安裝php
tar -jxvf php-5.2.4.tar.bz2      
cd php-5.2.4
./configure \
--prefix=/usr/local/php \
--with-mysql=/usr/local/mysql \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-gd --with-jpeg-dir=/usr/lib --enable-gd-native-ttf \
--with-zlib-dir=/usr/lib --with-png-dir=/usr/lib \
--with-freetype-dir=/usr/include/freetype2 --with-ttf \
--enable-sockets --enable-ftp --enable-mbstring --with-curl=/usr/local/curl
make && make install
cp php.ini-dist /usr/local/php/lib/php.ini
vi  /usr/local/apache2/conf/httpd.conf
加入一下代碼,添加apache支持php和web的默認文檔:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
###############for php and cacti###################
AddType application/x-tar .tgz
AddType application/x-httpd-php .php
AddType image/x-icon .ico
DirectoryIndex index.php index.html index.html.var
#######################over########################

service httpd start
 
可在/usr/local/apache2/htdocs目錄新增test.php
<?php
 phpinfo();
?>
查看是否gd和curl以驗證是否安裝成功.
安裝sharetronix
unzip sharetronix-1.5.1ver.zip
cp -R sharetronix-1.5.1ver/ upload /usr/local/apache2/htdocs/
mv upload microblog
chmod -R 777 microblog
配置sharetronix
 
按照他給你的信息就可以創建微博了,
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章