LiveJournal Server

来自开放百科 - 灰狐
跳转到: 导航, 搜索

LiveJournal is an open source content management system, written mainly in Perl[o]» and utilizing MySQL as a database backend. By itself, it serves as a powerful content updating system. In other uses, it is the framework application behind many successful online communities, including and

LiveJournal on Lighttpd

OSCON 2005 LiveJournal Backend



# apt-get install apache 
# apt-get install libapache-mod-perl apache-perl


$ cd $LJHOME // 注意不要以 root 帐号操作
/lj$ mkdir cvs
/lj$ cd cvs/
/lj/cvs$ svn co vcv
/lj/cvs$ svn co livejournal 
$ cd $LJHOME
/lj$ cvs/vcv/bin/vcv --conf=cvs/livejournal/cvs/multicvs.conf --checkout -c -s
Then in the future, to stay updated:

$ bin/ -u -c -s

( is just a front-end to vcv)

$ bin/
# apt-get install libclass-accessor-perl libclass-autouse-perl libclass-trigger-perl  
libdatetime-perl libdigest-hmac-perl perlmagick libmath-bigint-gmp-perl libnet-dns-perl  
libxml-atom-perl libxml-simple-perl

[Checking for Perl Modules....]
Missing optional module Crypt::DH: Required for OpenID support.
Missing optional module URI::Fetch: Required for OpenID support.
OpenID 目前还不知道如何设置 :(


 * Missing perl module: Unicode::CheckUTF8
cp doc/ cgi-bin/ // 一定要在创建数据库前设定
$ mysql -uroot -p
mysql> CREATE DATABASE livejournal;
mysql> GRANT ALL PRIVILEGES ON livejournal.* TO lj@'localhost' IDENTIFIED BY 'ljpass';  
mysql > flush privileges;
$ bin/upgrading/ --runsql --populate
The system user was created with a random password.
Run $LJHOME/bin/upgrading/ to change its password and grant the necessary privileges.# Done.
$ bin/upgrading/
$ bin/upgrading/ load // 成功创建 livejournal 数据库
#vi cgi-bin/
$DOMAIN = "debian";
#update /etc/apache-perl/httpd.conf
#crontab -e (同下)
vi /etc/apache-perl/httpd.conf
/etc/init.d/apache-perl start 
新版本还无法安装成功 :(


LJHOME=/home/lj; export LJHOME
wget // 版本有些旧,可通过 svn 获得最新版
svn co // 参照上面新版本的安装

update httpd.conf

ServerType standalone
ServerRoot "/etc/apache-perl"
PidFile /var/run/
ScoreBoardFile /var/run/apache-perl.scoreboard
Timeout 30
KeepAlive Off
MinSpareServers 5
MaxSpareServers 40
StartServers 10
MaxClients 20
MaxRequestsPerChild 500
LoadModule mime_module        /usr/lib/apache/1.3/
LoadModule autoindex_module   /usr/lib/apache/1.3/
LoadModule dir_module         /usr/lib/apache/1.3/
Port 80
User lj
Group lj
SendBufferSize 131072
PerlSetEnv   LJHOME /home/lj
PerlRequire  /home/lj/cgi-bin/
cp doc/ cgi-bin/


Required Modules

DBI	libdbi-perl
DBD::mysql	libdbd-mysql-perl
Digest::MD5	libdigest-md5-perl
Digest::SHA1	libdigest-sha1-perl
Image::Size	libimage-size-perl
MIME::Lite	libmime-lite-perl
MIME::Words	libmime-perl
Compress::Zlib	libcompress-zlib-perl
MIME::Base64	libmime-base64-perl
URI::URL	liburi-perl
HTML::Tagset	libhtml-tagset-perl
HTML::Parser	libhtml-parser-perl
LWP::Simple	libwww-perl
LWP::UserAgent	libwww-perl
GD	libgd-perl
Mail::Address	libmailtools-perl
Unicode::MapUTF8	libunicode-maputf8-perl
Storable	libstorable-perl
Time::HiRes	libtime-hires-perl


# perl -MCPAN -e shell
cpan> install Bundle::CPAN
cpan> reload cpan
cpan> install DBI
cpan> install DBD::mysql
cpan> install Digest::MD5
cpan> install Digest::SHA1
cpan> install Image::Size
cpan> install MIME::Lite
cpan> install MIME::Words
cpan> install Compress::Zlib
cpan> install MIME::Base64
cpan> install URI::URL
cpan> install HTML::Tagset
cpan> install HTML::Parser
cpan> install LWP::Simple
cpan> install LWP::UserAgent
cpan> install GD
cpan> install Mail::Address
cpan> install Unicode::MapUTF8
cpan> install Storable
cpan> install Time::HiRes
cpan> install IO::WrapTie
cpan> install Net::SMTP
cpan> install GD::Graph
cpan> install Proc::ProcessTable
cpan> install RPC::XML
cpan> install SOAP::Lite
cpan> install XML::RSS
cpan> install String::CRC32

Debian Install

# apt-get install libdbi-perl libdbd-mysql-perl libdigest-md5-perl \
libdigest-sha1-perl libimage-size-perl libmime-lite-perl \
libmime-perl libcompress-zlib-perl libmime-base64-perl \
liburi-perl libhtml-tagset-perl libhtml-parser-perl \
libwww-perl libwww-perl libgd-perl \
libmailtools-perl libunicode-maputf8-perl libstorable-perl \

# apt-get install libnet-perl libgd-graph-perl libproc-process-perl \
librpc-xml-perl libsoap-lite-perl libxml-rss-perl \
$ mysql -uroot -p
mysql> CREATE DATABASE livejournal;
mysql> GRANT ALL PRIVILEGES ON livejournal.* TO lj@'localhost' IDENTIFIED BY 'ljpass';  
mysql > flush privileges;
$ bin/upgrading/ --runsql --populate
$ bin/upgrading/ load // 成功创建 livejournal 数据库

crontab -e
[email protected]
# Essential:
* */12 * * * /home/lj/bin/ clean_caches >/dev/null
# Optional, if you want birthday mail, and the random user feature:
# (you can remove parts)
5 1 * * * /home/lj/bin/ bdaymail build_randomuserset >/dev/null
# If you want statistics:
30 1 * * * /home/lj/bin/ genstats genstatspics genstats_size >/dev/null
5 2 * * 0 /home/lj/bin/ genstats_weekly > /dev/null
# Various tasks
15 1 * * * /home/lj/bin/ joinmail > /dev/null
30 * * * * /home/lj/bin/ synsuck > /dev/null
5 2 * * 0 /home/lj/bin/ memeclean > /dev/null
# If you're running a high-load site with $LJ::BUFFER_QUERIES on,
# there's another one to install:
*/5 * * * * /home/lj/bin/ >/dev/null
apachectl restart

system/system // OK, 安装成功 :)