http://wiki.dreamwidth.net/wiki/api.php?action=feedcontributions&user=Vass&feedformat=atomDreamwidth Notes - User contributions [en]2024-03-29T15:09:21ZUser contributionsMediaWiki 1.23.0//wiki.dreamwidth.net/wiki/index.php/Subdomain_setupSubdomain setup2010-04-10T15:48:41Z<p>Vass: /* Configuration */</p>
<hr />
<div>== DNS Management ==<br />
<br />
First, you will also have to set up a wildcard subdomain record with your host. If you are hosting your DNS on Linode, here is an example of how to do this.<br />
<br />
Go to the DNS Manager section of your account and click on the domain zone your DW install is hosted on. Go to the "A/AAAA Records" section and note the IP address of the hosts:<br />
<br />
[[Image:Linode a records.png]]<br />
<br />
(Note: the above picture already has the wildcard listed in it. Yours won't have that yet, but will when you finish this.) You will want to click on "Add a new A/AAAA Record":<br />
<br />
[[Image:Linode subdomain wildcard.png]]<br />
<br />
Here, you will want to add <code>*.yourdomain.com</code> and the IP address you noted on the last page. Save this form and a wildcard subdomain should be added to your A/AAAA Records section.<br />
<br />
== Configuration ==<br />
<br />
{{Note|text=The current default scheme has links to places that are not subdomains.}}<br />
<br />
To configure your installation for user subdomains, uncomment the bolded lines in <code>$LJHOME/etc/config.pl</code>:<br />
<br />
<source lang="perl"># Support URLs of the form http://username.yoursite.com/ ?<br />
# If so, what's the part after "username." ?<br />
$USER_VHOSTS = 1;<br />
$USER_DOMAIN = $DOMAIN;<br />
<br />
# If you ONLY want USER_VHOSTS to work and not the typical /users/USER and /community/USER<br />
# then set this option:<br />
$ONLY_USER_VHOSTS = 1;</source><br />
<br />
If you only want certain user classes to have user subdomains, <b>do not</b> set <code>$ONLY_USER_VHOSTS</code> to 1, or journals who do not have this user capability won't work!<br />
<br />
You will also have to set a user capability in <code>etc/config.pl</code> called <code>userdomain</code>. If you want all users to have this capability, add it to <code>%CAP_DEF</code>:<br />
<br />
<source lang="perl">%CAP_DEF = ( <br />
'maxfriends' => 500,<br />
'userpics' => 1,<br />
'checkfriends_interval' => 60, <br />
'checkfriends' => 1,<br />
'styles' => 0,<br />
'todomax' => 25, <br />
'todosec' => 0,<br />
'friendsviewupdate' => 30, <br />
'findsim' => 1,<br />
'getselfemail' => 0,<br />
'userdomain' => 1<br />
);</source><br />
<br />
Otherwise, you will have to add <code>'userdomain' => 1</code> to one or more of the user classes listed in <code>%CAP</code>.<br />
<br />
You also need to add an entry to <code>%SUBDOMAIN_FUNCTIONS</code> (and create this hash if it does not already exist):<br />
<br />
<source lang="perl">%SUBDOMAIN_FUNCTION = ( <br />
'community' => 'journal',<br />
);</source><br />
<br />
[[Category: Dreamwidth Installation]]</div>Vass//wiki.dreamwidth.net/wiki/index.php/Dreamwidth_Scratch_InstallationDreamwidth Scratch Installation2010-04-05T13:27:34Z<p>Vass: /* Installing necessary packages */</p>
<hr />
<div>These are the instructions to install a Dreamwidth system from scratch, assuming you are running Ubuntu 9.04. Please note that the server currently segfaults under Ubuntu 9.10 setups. See [[Setting up Dreamwidth on Linode]] for instructions on setting up a system to the point where you can log in and start this. After you set up, you can keep updated with the instructions on [[Dev Maintenance]].<br />
<br />
If you have difficulties or problems or suggestions for installation procedures, please report them to [http://www.dwscoalition.org/show_bug.cgi?id=61 Bug 61]. Also look at [[Production Setup: Webserver]]. <br />
<br />
== Bringing the system up to date ==<br />
<br />
Before you start installing anything else, you might want to make sure your system is up to date. You should log in as root and update the packages on your system:<br />
<br />
apt-get update<br />
apt-get upgrade<br />
<br />
If you want man pages on your system: <br />
<br />
apt-get install man<br />
<br />
== Installing necessary packages ==<br />
<br />
This will install necessary packages you'll need to run Dreamwidth (and some optional ones). You'll want to be root when running these commands.<br />
<br />
apt-get install mercurial subversion apache2-mpm-prefork \<br />
libapache2-mod-perl2 libapache2-mod-apreq2 libapache2-request-perl \<br />
mysql-server wget unzip links vim libclass-autouse-perl \<br />
libcompress-zlib-perl libdatetime-perl libdigest-sha1-perl \<br />
libgd-gd2-perl libhtml-template-perl libwww-perl libmime-lite-perl \<br />
libnet-dns-perl liburi-perl libxml-simple-perl libclass-accessor-perl \<br />
libclass-data-inheritable-perl libclass-trigger-perl libcrypt-dh-perl \<br />
libmath-bigint-gmp-perl liburi-fetch-perl libgd-graph-perl \<br />
libgnupg-interface-perl libmail-gnupg-perl perlmagick \<br />
libproc-processtable-perl libsoap-lite-perl librpc-xml-perl \<br />
libstring-crc32-perl libtext-vcard-perl libxml-atom-perl libxml-rss-perl \<br />
libimage-size-perl libunicode-maputf8-perl libgtop2-dev build-essential \<br />
libnet-openid-consumer-perl libnet-openid-server-perl libyaml-perl \<br />
libcaptcha-recaptcha-perl libdbd-sqlite3-perl libtest-simple-perl \<br />
libtest-simpleunit-perl libtemplate-perl libterm-readkey-perl \<br />
libextutils-cbuilder-perl gcc<br />
<br />
This will download about 123MB of files and use around 446MB of disk space.<br />
<br />
Check whether these packages have actually installed. Later on in the process, if you find you are having inexplicable problems, try installing these again.<br />
<br />
[http://perl.apache.org/docs/2.0/user/install/install.html#Prerequisites Check] whether your system is using threaded MPMs or pre-fork. You will need the latter.<br />
<br />
If you have weird errors saying things like "Package mercurial is not available, but is referred to by another package.", try editing <tt>/etc/apt/sources.list</tt> and uncommenting the other repositories and then doing an <tt>apt-get</tt> update. Ran into this problem on a fresh install of <tt>jaunty</tt> on Linode.<br />
<br />
You will also want to install some perl libraries with CPAN. Defaults during CPAN's setup should be okay.<br />
<br />
Before installing, check if your CPAN shell has 'make' at the correct location. Run <tt>which make</tt>, then compare the results with running <tt>o conf make</tt> at the CPAN shell (to run the CPAN shell, type <tt>CPAN</tt>.)<br />
<br />
The perl libraries are:<br />
<br />
perl -MCPAN -e 'install Bundle::CPAN'<br />
perl -MCPAN -e 'install GTop' # this will guide you through setting up CPAN<br />
perl -MCPAN -e 'install Unicode::CheckUTF8'<br />
perl -MCPAN -e 'install Captcha::reCAPTCHA'<br />
perl -MCPAN -e 'install IP::Country::Fast'<br />
perl -MCPAN -e 'install Google::Checkout::General::GCO'<br />
<br />
See [http://wiki.dwscoalition.org/notes/Bundle::CPAN Bundle::CPAN] if you are having trouble installing Bundle::CPAN<br />
<br />
You will also want to install and configure Postfix so your DW can send out email:<br />
<br />
apt-get install postfix<br />
<br />
If you choose not to configure on the install, you can do so later with:<br />
<br />
dpkg-reconfigure postfix<br />
<br />
== Setting up the DW user account ==<br />
<br />
{{Note|text=If you still find yourself unable to make sudo commands even after <code>usermod</code>, please see [[Making your DW user a sudo account]] for alternatives.}} Create a user account that will be used for the code. This can be your own personal account if you wish, but it is recommended that you setup a new user that is only going to be used for running the code. That way if you have any insecure code running (i.e., a bad page, or a patch you're working on doesn't have security implemented yet) you don't have to worry about someone getting access to your personal files.<br />
<br />
To set up the user account:<br />
<br />
adduser <i>username</i><br />
<br />
Fill out the user's info and put them in the sudo group:<br />
<br />
usermod -a -G sudo <i>username</i><br />
<br />
So, to use <code>dw</code> as a username:<br />
<br />
adduser dw<br />
usermod -a -G sudo dw<br />
<br />
Now, we will get the $LJHOME variable set. Log into your user:<br />
<br />
su - dw<br />
<br />
We will assume that you use the bash shell. If you do not, then this section does not apply. You will have to find the shell specific way of setting environment variables.<br />
<br />
For bash, you should look in the home directory of the user account you just created for a file .profile. You will want to add one more line to this file:<br />
<br />
export LJHOME=/home/dw<br />
<br />
Or whatever your user account's home directory is. Yes, the variable is named LJHOME. We'll live with it for now. ;-)<br />
<br />
Test this. Log out of your user account and log back in, then type:<br />
<br />
echo $LJHOME<br />
<br />
You should see /home/dw or whatever you set it to. If you don't, then you didn't get the export line in the right place. (Hey, I'm not here to teach basic sysadmin stuff. You should know how to set environment variables.)<br />
<br />
== Downloading the Dreamwidth code ==<br />
<br />
You should do this as the user you want to run Dreamwidth as. If you are root, you can switch with:<br />
<br />
su - dw<br />
<br />
We have put together a bootstrap script that will download all of the code. You can obtain this file with your favorite tool (wget, curl, etc):<br />
<br />
wget http://hg.dwscoalition.org/dw-free/raw-file/tip/bin/bootstrap.pl<br />
<br />
The next step is fairly automatic. Assuming that your $LJHOME environment variable is good to go, you should be able to just do this:<br />
<br />
perl bootstrap.pl<br />
<br />
The script will start doing some work. It should start out by saying 'seems we need to start at the beginning', which is what you expect. Then you will sit around for half an hour while it checks out various packages and repositories from various locations.<br />
<br />
When it's done, it will say so. It will also say to delete the bootstrap script: <br />
<br />
rm bootstrap.pl<br />
<br />
Do a quick ls in $LJHOME to see if you have a bunch of new directories like cvs, cgi-bin, htdocs, etc. If you do, huzzah! You now have the code checked out.<br />
<br />
If you don't, figure out what step didn't work, and try again. All else fails, hit the mailing list or find someone on IRC.<br />
<br />
=== dw-nonfree ===<br />
<br />
{{Warn|text=This should not be used on installations that are not Dreamwidth development installations.}} <br />
<br />
If you are doing development on Dreamwidth custom files (what few there are), then you will need to do another step. This is fairly manual, the bootstrap script does not handle this process for you. But assuming that you did the above steps, you can get dw-nonfree code like this:<br />
<br />
cd $LJHOME/cvs<br />
hg clone http://hg.dwscoalition.org/dw-nonfree dw-nonfree<br />
cp dw-nonfree/cvs/multicvs-local.conf .<br />
<br />
You may want to look at [[Keeping your site configs from wiping during updates]] if you want to keep your config files from getting wiped during subsequent updates if you're using <tt>dw-nonfree</tt>.<br />
<br />
=== Updating to the tip ===<br />
<br />
As of right now, you have the code that existed up until the end of the initial branch with no name, ending in changeset [http://hg.dwscoalition.org/dw-free/rev/1defc551af6c 1defc551af6c] from October 13th 2008. However, with the next commit on January 14th 2009, named branches were introduced, and the dw-free repository now uses all named branches. (currently there is only one named branch that is up to date, 'production')<br />
<br />
Right now, bootstrap.pl gives you the SVN repository, rather than an HG which is currently used and as such cvsreport.pl fails because it expected HG.<br />
<br />
Remove it and then do checkout:<br />
<br />
cd $LJHOME/cvs/dw-free<br />
hg update -C tip<br />
cd $LJHOME<br />
bin/cvsreport.pl -sync -cvsonly<br />
rm -rf cvs/perlbal/<br />
rm -rf cvs/js/<br />
bin/cvsreport.pl --checkout<br />
bin/cvsreport.pl -sync -cvsonly<br />
<br />
<br />
You need to do the last line twice, since the multicvs.conf file has changed since then. Any future updates should now work as described on the [[Dev Maintenance]] page. You will also want to delete files that no longer exist in the repository:<br />
<br />
<source lang="bash">cd $LJHOME; for i in `bin/cvsreport.pl -n -1`; do echo "Removing $i" && rm $i; done</source><br />
<br />
== Database setup ==<br />
<br />
You should have a local MySQL installation and know the root login to the database. To sign into MySQL as root:<br />
<br />
mysql -u root -p <br />
<br />
These MySQL commands wil create your development database:<br />
<br />
create database dw;<br />
grant all on dw.* to 'dw'@'localhost' identified by 'somePassword';<br />
quit;<br />
<br />
You might want to pick a more appropriate database username/database name/password.<br />
<br />
== Editing the config files ==<br />
<br />
Next you need to configure the site configuration scripts. This is probably the most tricky part of the whole process, since there are so many things you can tweak. However, you can get by with just tweaking etc/config-local.pl and etc/config-private.pl for now:<br />
<br />
cd $LJHOME<br />
cp doc/config-local.pl.txt etc/config-local.pl<br />
vim etc/config-local.pl<br />
<br />
Or use your editor of choice, of course. Do a search for the phrase 'CHANGE THIS' which occurs once, before the block of human readable text you should use to describe your development installation.<br />
<br />
Note that the <var>$IS_DEV_SERVER</var> flag is set to 1 in the template given. Be sure to set this to 0 for a production site, as there are big security issues involved with leaving the flag set to 1. <br />
<br />
Next, you need to change your local variables in the <tt>config-private.pl</tt> file. This is where your passwords are configured, as well as many of the variables which define your domain. Do a search for the phrase 'CHANGETHIS'(note the slightly different spacing). You will want to change at least your <var>$DOMAIN</var> and the <var>%DBINFO</var> structure.<br />
<br />
cd $LJHOME<br />
cp doc/config-private.pl.txt etc/config-private.pl<br />
chmod go-rwx etc/config-private.pl<br />
vim etc/config-private.pl<br />
<br />
In this file, uncomment the lines in the <var>%DBINFO</var> blocks (if they are commented out), and place your database password in quotes on the "pass => ," line, before the comma. For example:<br />
<br />
%DBINFO = (<br />
master => {<br />
pass => 'mypassword',<br />
},<br />
);<br />
<br />
Note that there are two DBINFO blocks; get them both.<br />
<br />
The base configuration file is under source control, and is already in <tt>etc/config.pl</tt>. You should not need to change anything very much in this, but you might have to change some stuff. If you find you do have to touch this, please see [http://bugs.dwscoalition.org/show_bug.cgi?id=165] first. Then you can edit it:<br />
<br />
vim etc/config.pl<br />
<br />
== Make sure things are working with checkconfig.pl ==<br />
<br />
Now, you need to see if everything is working. <br />
<br />
If you've setup the files as indicated above, run this command:<br />
<br />
cd $LJHOME<br />
bin/checkconfig.pl --no=ljconfig<br />
<br />
If you installed everything given at the top of this page, you should find you have no missing modules. Congratulations! If you don't have all the modules, this is where you need some systems specific knowledge for your system. You will need to install whatever modules are missing. If you get well and truly stuck, find someone on IRC or the mailing list.<br />
<br />
== Populate database with initial data ==<br />
<br />
There are a few commands you can now run to install the database. Just run these and watch for errors.<br />
<br />
<b>Note:</b> If make_system.pl says it can't give the system user admin privileges, something has gone wrong with your database population, even if there were no errors.<br />
<br />
$LJHOME/bin/upgrading/update-db.pl -r --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -p<br />
<br />
(That step will ask you for a password for the system account. You can change it later by logging in as system, so just give it something for now.)<br />
<br />
$LJHOME/bin/upgrading/make_system.pl<br />
$LJHOME/bin/upgrading/texttool.pl load<br />
<br />
== Configure Apache ==<br />
<br />
This step will need to be done as the root user. Below is the Apache 2 configuration running on the Dreamwidth staging site. Put this in a file named "stage" in /etc/apache2/conf.d:<br />
<br />
User dw<br />
Group dw<br />
UseCanonicalName off<br />
<br />
StartServers 1<br />
MaxSpareServers 2<br />
MinSpareServers 1<br />
<br />
DocumentRoot /home/dw/htdocs<br />
<br />
PerlSetEnv LJHOME /home/dw<br />
PerlPassEnv LJHOME<br />
<br />
PerlRequire /home/dw/cgi-bin/modperl.pl<br />
<br />
Then disable the default site:<br />
<br />
a2dissite default<br />
<br />
You might also have to enable the Perl Apache Request module:<br />
<br />
a2enmod apreq<br />
<br />
If you don't want this warning:<br />
<br />
[Thu Jan 15 01:46:54 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
... waiting [Thu Jan 15 01:46:55 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
...done.<br />
<br />
Then use <code>vim /etc/apache2/ports.conf</code> and put a # in front of the NameVirtualHost line:<br />
<br />
# NameVirtualHost *:80<br />
<br />
Restart the server:<br />
<br />
/etc/init.d/apache2 restart<br />
<br />
== Now what? ==<br />
<br />
=== Have a look at your new DW instance ===<br />
<br />
Congratulations! You now have a working (though minimal) Dreamwidth install. If you point your web browser at your server, you should see a bare-looking welcome page.<br />
<br />
=== Further setup ===<br />
<br />
There are lots of other articles on setting up and customizing your DW install in the [[:Category: Dreamwidth Installation|DW Installation]] category, including:<br />
<br />
* [[TheSchwartz Setup]] - TheSchwartz is needed for a handful of features - notably comment posting<br />
* [[Subdomain setup]]<br />
* [[Statistics setup]]<br />
* [[Generating documentation]]<br />
* [[Allow users to register]]<br />
<br />
There is a list of wanted how-tos at [[Installation Wanted How-To]], in case you need to add something to the list.<br />
<br />
=== Starting development ===<br />
<br />
The list of things that need doing are in [http://bugs.dwscoalition.org/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailqa_contact2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfie Bugzilla]. You can keep your code update with the instructions in [[Dev Maintenance]]. Instructions on submitting patches are in [[Dev Patches]].<br />
<br />
[[Category: Dreamwidth Installation]]</div>Vass//wiki.dreamwidth.net/wiki/index.php/Dreamwidth_Scratch_InstallationDreamwidth Scratch Installation2010-04-05T13:24:28Z<p>Vass: /* Installing necessary packages */</p>
<hr />
<div>These are the instructions to install a Dreamwidth system from scratch, assuming you are running Ubuntu 9.04. Please note that the server currently segfaults under Ubuntu 9.10 setups. See [[Setting up Dreamwidth on Linode]] for instructions on setting up a system to the point where you can log in and start this. After you set up, you can keep updated with the instructions on [[Dev Maintenance]].<br />
<br />
If you have difficulties or problems or suggestions for installation procedures, please report them to [http://www.dwscoalition.org/show_bug.cgi?id=61 Bug 61]. Also look at [[Production Setup: Webserver]]. <br />
<br />
== Bringing the system up to date ==<br />
<br />
Before you start installing anything else, you might want to make sure your system is up to date. You should log in as root and update the packages on your system:<br />
<br />
apt-get update<br />
apt-get upgrade<br />
<br />
If you want man pages on your system: <br />
<br />
apt-get install man<br />
<br />
== Installing necessary packages ==<br />
<br />
This will install necessary packages you'll need to run Dreamwidth (and some optional ones). You'll want to be root when running these commands.<br />
<br />
apt-get install mercurial subversion apache2-mpm-prefork \<br />
libapache2-mod-perl2 libapache2-mod-apreq2 libapache2-request-perl \<br />
mysql-server wget unzip links vim libclass-autouse-perl \<br />
libcompress-zlib-perl libdatetime-perl libdigest-sha1-perl \<br />
libgd-gd2-perl libhtml-template-perl libwww-perl libmime-lite-perl \<br />
libnet-dns-perl liburi-perl libxml-simple-perl libclass-accessor-perl \<br />
libclass-data-inheritable-perl libclass-trigger-perl libcrypt-dh-perl \<br />
libmath-bigint-gmp-perl liburi-fetch-perl libgd-graph-perl \<br />
libgnupg-interface-perl libmail-gnupg-perl perlmagick \<br />
libproc-processtable-perl libsoap-lite-perl librpc-xml-perl \<br />
libstring-crc32-perl libtext-vcard-perl libxml-atom-perl libxml-rss-perl \<br />
libimage-size-perl libunicode-maputf8-perl libgtop2-dev build-essential \<br />
libnet-openid-consumer-perl libnet-openid-server-perl libyaml-perl \<br />
libcaptcha-recaptcha-perl libdbd-sqlite3-perl libtest-simple-perl \<br />
libtest-simpleunit-perl libtemplate-perl libterm-readkey-perl \<br />
libextutils-cbuilder-perl gcc<br />
<br />
This will download about 123MB of files and use around 446MB of disk space.<br />
<br />
Check whether these packages have actually installed. Later on in the process, if you find you are having inexplicable problems, try installing these again.<br />
<br />
[http://perl.apache.org/docs/2.0/user/install/install.html#Prerequisites Check] whether your system is using threaded MPMs or pre-fork. You will need the latter.<br />
<br />
If you have weird errors saying things like "Package mercurial is not available, but is referred to by another package.", try editing <tt>/etc/apt/sources.list</tt> and uncommenting the other repositories and then doing an <tt>apt-get</tt> update. Ran into this problem on a fresh install of <tt>jaunty</tt> on Linode.<br />
<br />
You will also want to install some perl libraries with CPAN. Defaults during CPAN's setup should be okay.<br />
<br />
Before installing, check if your CPAN shell has 'make' at the correct location. Run <tt>which make</tt>, then compare the results with running <tt>o conf make</tt> at the CPAN shell (to run the CPAN shell, type <tt>CPAN</tt>.)<br />
<br />
The perl libraries are:<br />
<br />
perl -MCPAN -e 'install Bundle::CPAN'<br />
perl -MCPAN -e 'install GTop' # this will guide you through setting up CPAN<br />
perl -MCPAN -e 'install Unicode::CheckUTF8'<br />
perl -MCPAN -e 'install Captcha::reCAPTCHA'<br />
perl -MCPAN -e 'install IP::Country::Fast'<br />
perl -MCPAN -e 'install Google::Checkout::General::GCO'<br />
<br />
See [[Bundle::CPAN]] if you are having trouble installing Bundle::CPAN<br />
<br />
You will also want to install and configure Postfix so your DW can send out email:<br />
<br />
apt-get install postfix<br />
<br />
If you choose not to configure on the install, you can do so later with:<br />
<br />
dpkg-reconfigure postfix<br />
<br />
== Setting up the DW user account ==<br />
<br />
{{Note|text=If you still find yourself unable to make sudo commands even after <code>usermod</code>, please see [[Making your DW user a sudo account]] for alternatives.}} Create a user account that will be used for the code. This can be your own personal account if you wish, but it is recommended that you setup a new user that is only going to be used for running the code. That way if you have any insecure code running (i.e., a bad page, or a patch you're working on doesn't have security implemented yet) you don't have to worry about someone getting access to your personal files.<br />
<br />
To set up the user account:<br />
<br />
adduser <i>username</i><br />
<br />
Fill out the user's info and put them in the sudo group:<br />
<br />
usermod -a -G sudo <i>username</i><br />
<br />
So, to use <code>dw</code> as a username:<br />
<br />
adduser dw<br />
usermod -a -G sudo dw<br />
<br />
Now, we will get the $LJHOME variable set. Log into your user:<br />
<br />
su - dw<br />
<br />
We will assume that you use the bash shell. If you do not, then this section does not apply. You will have to find the shell specific way of setting environment variables.<br />
<br />
For bash, you should look in the home directory of the user account you just created for a file .profile. You will want to add one more line to this file:<br />
<br />
export LJHOME=/home/dw<br />
<br />
Or whatever your user account's home directory is. Yes, the variable is named LJHOME. We'll live with it for now. ;-)<br />
<br />
Test this. Log out of your user account and log back in, then type:<br />
<br />
echo $LJHOME<br />
<br />
You should see /home/dw or whatever you set it to. If you don't, then you didn't get the export line in the right place. (Hey, I'm not here to teach basic sysadmin stuff. You should know how to set environment variables.)<br />
<br />
== Downloading the Dreamwidth code ==<br />
<br />
You should do this as the user you want to run Dreamwidth as. If you are root, you can switch with:<br />
<br />
su - dw<br />
<br />
We have put together a bootstrap script that will download all of the code. You can obtain this file with your favorite tool (wget, curl, etc):<br />
<br />
wget http://hg.dwscoalition.org/dw-free/raw-file/tip/bin/bootstrap.pl<br />
<br />
The next step is fairly automatic. Assuming that your $LJHOME environment variable is good to go, you should be able to just do this:<br />
<br />
perl bootstrap.pl<br />
<br />
The script will start doing some work. It should start out by saying 'seems we need to start at the beginning', which is what you expect. Then you will sit around for half an hour while it checks out various packages and repositories from various locations.<br />
<br />
When it's done, it will say so. It will also say to delete the bootstrap script: <br />
<br />
rm bootstrap.pl<br />
<br />
Do a quick ls in $LJHOME to see if you have a bunch of new directories like cvs, cgi-bin, htdocs, etc. If you do, huzzah! You now have the code checked out.<br />
<br />
If you don't, figure out what step didn't work, and try again. All else fails, hit the mailing list or find someone on IRC.<br />
<br />
=== dw-nonfree ===<br />
<br />
{{Warn|text=This should not be used on installations that are not Dreamwidth development installations.}} <br />
<br />
If you are doing development on Dreamwidth custom files (what few there are), then you will need to do another step. This is fairly manual, the bootstrap script does not handle this process for you. But assuming that you did the above steps, you can get dw-nonfree code like this:<br />
<br />
cd $LJHOME/cvs<br />
hg clone http://hg.dwscoalition.org/dw-nonfree dw-nonfree<br />
cp dw-nonfree/cvs/multicvs-local.conf .<br />
<br />
You may want to look at [[Keeping your site configs from wiping during updates]] if you want to keep your config files from getting wiped during subsequent updates if you're using <tt>dw-nonfree</tt>.<br />
<br />
=== Updating to the tip ===<br />
<br />
As of right now, you have the code that existed up until the end of the initial branch with no name, ending in changeset [http://hg.dwscoalition.org/dw-free/rev/1defc551af6c 1defc551af6c] from October 13th 2008. However, with the next commit on January 14th 2009, named branches were introduced, and the dw-free repository now uses all named branches. (currently there is only one named branch that is up to date, 'production')<br />
<br />
Right now, bootstrap.pl gives you the SVN repository, rather than an HG which is currently used and as such cvsreport.pl fails because it expected HG.<br />
<br />
Remove it and then do checkout:<br />
<br />
cd $LJHOME/cvs/dw-free<br />
hg update -C tip<br />
cd $LJHOME<br />
bin/cvsreport.pl -sync -cvsonly<br />
rm -rf cvs/perlbal/<br />
rm -rf cvs/js/<br />
bin/cvsreport.pl --checkout<br />
bin/cvsreport.pl -sync -cvsonly<br />
<br />
<br />
You need to do the last line twice, since the multicvs.conf file has changed since then. Any future updates should now work as described on the [[Dev Maintenance]] page. You will also want to delete files that no longer exist in the repository:<br />
<br />
<source lang="bash">cd $LJHOME; for i in `bin/cvsreport.pl -n -1`; do echo "Removing $i" && rm $i; done</source><br />
<br />
== Database setup ==<br />
<br />
You should have a local MySQL installation and know the root login to the database. To sign into MySQL as root:<br />
<br />
mysql -u root -p <br />
<br />
These MySQL commands wil create your development database:<br />
<br />
create database dw;<br />
grant all on dw.* to 'dw'@'localhost' identified by 'somePassword';<br />
quit;<br />
<br />
You might want to pick a more appropriate database username/database name/password.<br />
<br />
== Editing the config files ==<br />
<br />
Next you need to configure the site configuration scripts. This is probably the most tricky part of the whole process, since there are so many things you can tweak. However, you can get by with just tweaking etc/config-local.pl and etc/config-private.pl for now:<br />
<br />
cd $LJHOME<br />
cp doc/config-local.pl.txt etc/config-local.pl<br />
vim etc/config-local.pl<br />
<br />
Or use your editor of choice, of course. Do a search for the phrase 'CHANGE THIS' which occurs once, before the block of human readable text you should use to describe your development installation.<br />
<br />
Note that the <var>$IS_DEV_SERVER</var> flag is set to 1 in the template given. Be sure to set this to 0 for a production site, as there are big security issues involved with leaving the flag set to 1. <br />
<br />
Next, you need to change your local variables in the <tt>config-private.pl</tt> file. This is where your passwords are configured, as well as many of the variables which define your domain. Do a search for the phrase 'CHANGETHIS'(note the slightly different spacing). You will want to change at least your <var>$DOMAIN</var> and the <var>%DBINFO</var> structure.<br />
<br />
cd $LJHOME<br />
cp doc/config-private.pl.txt etc/config-private.pl<br />
chmod go-rwx etc/config-private.pl<br />
vim etc/config-private.pl<br />
<br />
In this file, uncomment the lines in the <var>%DBINFO</var> blocks (if they are commented out), and place your database password in quotes on the "pass => ," line, before the comma. For example:<br />
<br />
%DBINFO = (<br />
master => {<br />
pass => 'mypassword',<br />
},<br />
);<br />
<br />
Note that there are two DBINFO blocks; get them both.<br />
<br />
The base configuration file is under source control, and is already in <tt>etc/config.pl</tt>. You should not need to change anything very much in this, but you might have to change some stuff. If you find you do have to touch this, please see [http://bugs.dwscoalition.org/show_bug.cgi?id=165] first. Then you can edit it:<br />
<br />
vim etc/config.pl<br />
<br />
== Make sure things are working with checkconfig.pl ==<br />
<br />
Now, you need to see if everything is working. <br />
<br />
If you've setup the files as indicated above, run this command:<br />
<br />
cd $LJHOME<br />
bin/checkconfig.pl --no=ljconfig<br />
<br />
If you installed everything given at the top of this page, you should find you have no missing modules. Congratulations! If you don't have all the modules, this is where you need some systems specific knowledge for your system. You will need to install whatever modules are missing. If you get well and truly stuck, find someone on IRC or the mailing list.<br />
<br />
== Populate database with initial data ==<br />
<br />
There are a few commands you can now run to install the database. Just run these and watch for errors.<br />
<br />
<b>Note:</b> If make_system.pl says it can't give the system user admin privileges, something has gone wrong with your database population, even if there were no errors.<br />
<br />
$LJHOME/bin/upgrading/update-db.pl -r --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -p<br />
<br />
(That step will ask you for a password for the system account. You can change it later by logging in as system, so just give it something for now.)<br />
<br />
$LJHOME/bin/upgrading/make_system.pl<br />
$LJHOME/bin/upgrading/texttool.pl load<br />
<br />
== Configure Apache ==<br />
<br />
This step will need to be done as the root user. Below is the Apache 2 configuration running on the Dreamwidth staging site. Put this in a file named "stage" in /etc/apache2/conf.d:<br />
<br />
User dw<br />
Group dw<br />
UseCanonicalName off<br />
<br />
StartServers 1<br />
MaxSpareServers 2<br />
MinSpareServers 1<br />
<br />
DocumentRoot /home/dw/htdocs<br />
<br />
PerlSetEnv LJHOME /home/dw<br />
PerlPassEnv LJHOME<br />
<br />
PerlRequire /home/dw/cgi-bin/modperl.pl<br />
<br />
Then disable the default site:<br />
<br />
a2dissite default<br />
<br />
You might also have to enable the Perl Apache Request module:<br />
<br />
a2enmod apreq<br />
<br />
If you don't want this warning:<br />
<br />
[Thu Jan 15 01:46:54 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
... waiting [Thu Jan 15 01:46:55 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
...done.<br />
<br />
Then use <code>vim /etc/apache2/ports.conf</code> and put a # in front of the NameVirtualHost line:<br />
<br />
# NameVirtualHost *:80<br />
<br />
Restart the server:<br />
<br />
/etc/init.d/apache2 restart<br />
<br />
== Now what? ==<br />
<br />
=== Have a look at your new DW instance ===<br />
<br />
Congratulations! You now have a working (though minimal) Dreamwidth install. If you point your web browser at your server, you should see a bare-looking welcome page.<br />
<br />
=== Further setup ===<br />
<br />
There are lots of other articles on setting up and customizing your DW install in the [[:Category: Dreamwidth Installation|DW Installation]] category, including:<br />
<br />
* [[TheSchwartz Setup]] - TheSchwartz is needed for a handful of features - notably comment posting<br />
* [[Subdomain setup]]<br />
* [[Statistics setup]]<br />
* [[Generating documentation]]<br />
* [[Allow users to register]]<br />
<br />
There is a list of wanted how-tos at [[Installation Wanted How-To]], in case you need to add something to the list.<br />
<br />
=== Starting development ===<br />
<br />
The list of things that need doing are in [http://bugs.dwscoalition.org/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailqa_contact2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfie Bugzilla]. You can keep your code update with the instructions in [[Dev Maintenance]]. Instructions on submitting patches are in [[Dev Patches]].<br />
<br />
[[Category: Dreamwidth Installation]]</div>Vass//wiki.dreamwidth.net/wiki/index.php/Dreamwidth_Scratch_InstallationDreamwidth Scratch Installation2010-04-05T13:12:02Z<p>Vass: /* Installing necessary packages */</p>
<hr />
<div>These are the instructions to install a Dreamwidth system from scratch, assuming you are running Ubuntu 9.04. Please note that the server currently segfaults under Ubuntu 9.10 setups. See [[Setting up Dreamwidth on Linode]] for instructions on setting up a system to the point where you can log in and start this. After you set up, you can keep updated with the instructions on [[Dev Maintenance]].<br />
<br />
If you have difficulties or problems or suggestions for installation procedures, please report them to [http://www.dwscoalition.org/show_bug.cgi?id=61 Bug 61]. Also look at [[Production Setup: Webserver]]. <br />
<br />
== Bringing the system up to date ==<br />
<br />
Before you start installing anything else, you might want to make sure your system is up to date. You should log in as root and update the packages on your system:<br />
<br />
apt-get update<br />
apt-get upgrade<br />
<br />
If you want man pages on your system: <br />
<br />
apt-get install man<br />
<br />
== Installing necessary packages ==<br />
<br />
This will install necessary packages you'll need to run Dreamwidth (and some optional ones). You'll want to be root when running these commands.<br />
<br />
apt-get install mercurial subversion apache2-mpm-prefork \<br />
libapache2-mod-perl2 libapache2-mod-apreq2 libapache2-request-perl \<br />
mysql-server wget unzip links vim libclass-autouse-perl \<br />
libcompress-zlib-perl libdatetime-perl libdigest-sha1-perl \<br />
libgd-gd2-perl libhtml-template-perl libwww-perl libmime-lite-perl \<br />
libnet-dns-perl liburi-perl libxml-simple-perl libclass-accessor-perl \<br />
libclass-data-inheritable-perl libclass-trigger-perl libcrypt-dh-perl \<br />
libmath-bigint-gmp-perl liburi-fetch-perl libgd-graph-perl \<br />
libgnupg-interface-perl libmail-gnupg-perl perlmagick \<br />
libproc-processtable-perl libsoap-lite-perl librpc-xml-perl \<br />
libstring-crc32-perl libtext-vcard-perl libxml-atom-perl libxml-rss-perl \<br />
libimage-size-perl libunicode-maputf8-perl libgtop2-dev build-essential \<br />
libnet-openid-consumer-perl libnet-openid-server-perl libyaml-perl \<br />
libcaptcha-recaptcha-perl libdbd-sqlite3-perl libtest-simple-perl \<br />
libtest-simpleunit-perl libtemplate-perl libterm-readkey-perl \<br />
libextutils-cbuilder-perl gcc<br />
<br />
This will download about 123MB of files and use around 446MB of disk space.<br />
<br />
Check whether these packages have actually installed. Later on in the process, if you find you are having inexplicable problems, try installing these again.<br />
<br />
[http://perl.apache.org/docs/2.0/user/install/install.html#Prerequisites Check] whether your system is using threaded MPMs or pre-fork. You will need the latter.<br />
<br />
If you have weird errors saying things like "Package mercurial is not available, but is referred to by another package.", try editing <tt>/etc/apt/sources.list</tt> and uncommenting the other repositories and then doing an <tt>apt-get</tt> update. Ran into this problem on a fresh install of <tt>jaunty</tt> on Linode.<br />
<br />
You will also want to install some perl libraries with CPAN. Defaults during CPAN's setup should be okay.<br />
<br />
Before installing, check if your CPAN shell has 'make' at the correct location. Run <tt>which make</tt>, then compare the results with running <tt>o conf make</tt> at the CPAN shell (to run the CPAN shell, type <tt>CPAN</tt>.)<br />
<br />
The perl libraries are:<br />
<br />
perl -MCPAN -e 'install Bundle::CPAN'<br />
perl -MCPAN -e 'install GTop' # this will guide you through setting up CPAN<br />
perl -MCPAN -e 'install Unicode::CheckUTF8'<br />
perl -MCPAN -e 'install Captcha::reCAPTCHA'<br />
perl -MCPAN -e 'install IP::Country::Fast'<br />
perl -MCPAN -e 'install Google::Checkout::General::GCO'<br />
<br />
You will also want to install and configure Postfix so your DW can send out email:<br />
<br />
apt-get install postfix<br />
<br />
If you choose not to configure on the install, you can do so later with:<br />
<br />
dpkg-reconfigure postfix<br />
<br />
== Setting up the DW user account ==<br />
<br />
{{Note|text=If you still find yourself unable to make sudo commands even after <code>usermod</code>, please see [[Making your DW user a sudo account]] for alternatives.}} Create a user account that will be used for the code. This can be your own personal account if you wish, but it is recommended that you setup a new user that is only going to be used for running the code. That way if you have any insecure code running (i.e., a bad page, or a patch you're working on doesn't have security implemented yet) you don't have to worry about someone getting access to your personal files.<br />
<br />
To set up the user account:<br />
<br />
adduser <i>username</i><br />
<br />
Fill out the user's info and put them in the sudo group:<br />
<br />
usermod -a -G sudo <i>username</i><br />
<br />
So, to use <code>dw</code> as a username:<br />
<br />
adduser dw<br />
usermod -a -G sudo dw<br />
<br />
Now, we will get the $LJHOME variable set. Log into your user:<br />
<br />
su - dw<br />
<br />
We will assume that you use the bash shell. If you do not, then this section does not apply. You will have to find the shell specific way of setting environment variables.<br />
<br />
For bash, you should look in the home directory of the user account you just created for a file .profile. You will want to add one more line to this file:<br />
<br />
export LJHOME=/home/dw<br />
<br />
Or whatever your user account's home directory is. Yes, the variable is named LJHOME. We'll live with it for now. ;-)<br />
<br />
Test this. Log out of your user account and log back in, then type:<br />
<br />
echo $LJHOME<br />
<br />
You should see /home/dw or whatever you set it to. If you don't, then you didn't get the export line in the right place. (Hey, I'm not here to teach basic sysadmin stuff. You should know how to set environment variables.)<br />
<br />
== Downloading the Dreamwidth code ==<br />
<br />
You should do this as the user you want to run Dreamwidth as. If you are root, you can switch with:<br />
<br />
su - dw<br />
<br />
We have put together a bootstrap script that will download all of the code. You can obtain this file with your favorite tool (wget, curl, etc):<br />
<br />
wget http://hg.dwscoalition.org/dw-free/raw-file/tip/bin/bootstrap.pl<br />
<br />
The next step is fairly automatic. Assuming that your $LJHOME environment variable is good to go, you should be able to just do this:<br />
<br />
perl bootstrap.pl<br />
<br />
The script will start doing some work. It should start out by saying 'seems we need to start at the beginning', which is what you expect. Then you will sit around for half an hour while it checks out various packages and repositories from various locations.<br />
<br />
When it's done, it will say so. It will also say to delete the bootstrap script: <br />
<br />
rm bootstrap.pl<br />
<br />
Do a quick ls in $LJHOME to see if you have a bunch of new directories like cvs, cgi-bin, htdocs, etc. If you do, huzzah! You now have the code checked out.<br />
<br />
If you don't, figure out what step didn't work, and try again. All else fails, hit the mailing list or find someone on IRC.<br />
<br />
=== dw-nonfree ===<br />
<br />
{{Warn|text=This should not be used on installations that are not Dreamwidth development installations.}} <br />
<br />
If you are doing development on Dreamwidth custom files (what few there are), then you will need to do another step. This is fairly manual, the bootstrap script does not handle this process for you. But assuming that you did the above steps, you can get dw-nonfree code like this:<br />
<br />
cd $LJHOME/cvs<br />
hg clone http://hg.dwscoalition.org/dw-nonfree dw-nonfree<br />
cp dw-nonfree/cvs/multicvs-local.conf .<br />
<br />
You may want to look at [[Keeping your site configs from wiping during updates]] if you want to keep your config files from getting wiped during subsequent updates if you're using <tt>dw-nonfree</tt>.<br />
<br />
=== Updating to the tip ===<br />
<br />
As of right now, you have the code that existed up until the end of the initial branch with no name, ending in changeset [http://hg.dwscoalition.org/dw-free/rev/1defc551af6c 1defc551af6c] from October 13th 2008. However, with the next commit on January 14th 2009, named branches were introduced, and the dw-free repository now uses all named branches. (currently there is only one named branch that is up to date, 'production')<br />
<br />
Right now, bootstrap.pl gives you the SVN repository, rather than an HG which is currently used and as such cvsreport.pl fails because it expected HG.<br />
<br />
Remove it and then do checkout:<br />
<br />
cd $LJHOME/cvs/dw-free<br />
hg update -C tip<br />
cd $LJHOME<br />
bin/cvsreport.pl -sync -cvsonly<br />
rm -rf cvs/perlbal/<br />
rm -rf cvs/js/<br />
bin/cvsreport.pl --checkout<br />
bin/cvsreport.pl -sync -cvsonly<br />
<br />
<br />
You need to do the last line twice, since the multicvs.conf file has changed since then. Any future updates should now work as described on the [[Dev Maintenance]] page. You will also want to delete files that no longer exist in the repository:<br />
<br />
<source lang="bash">cd $LJHOME; for i in `bin/cvsreport.pl -n -1`; do echo "Removing $i" && rm $i; done</source><br />
<br />
== Database setup ==<br />
<br />
You should have a local MySQL installation and know the root login to the database. To sign into MySQL as root:<br />
<br />
mysql -u root -p <br />
<br />
These MySQL commands wil create your development database:<br />
<br />
create database dw;<br />
grant all on dw.* to 'dw'@'localhost' identified by 'somePassword';<br />
quit;<br />
<br />
You might want to pick a more appropriate database username/database name/password.<br />
<br />
== Editing the config files ==<br />
<br />
Next you need to configure the site configuration scripts. This is probably the most tricky part of the whole process, since there are so many things you can tweak. However, you can get by with just tweaking etc/config-local.pl and etc/config-private.pl for now:<br />
<br />
cd $LJHOME<br />
cp doc/config-local.pl.txt etc/config-local.pl<br />
vim etc/config-local.pl<br />
<br />
Or use your editor of choice, of course. Do a search for the phrase 'CHANGE THIS' which occurs once, before the block of human readable text you should use to describe your development installation.<br />
<br />
Note that the <var>$IS_DEV_SERVER</var> flag is set to 1 in the template given. Be sure to set this to 0 for a production site, as there are big security issues involved with leaving the flag set to 1. <br />
<br />
Next, you need to change your local variables in the <tt>config-private.pl</tt> file. This is where your passwords are configured, as well as many of the variables which define your domain. Do a search for the phrase 'CHANGETHIS'(note the slightly different spacing). You will want to change at least your <var>$DOMAIN</var> and the <var>%DBINFO</var> structure.<br />
<br />
cd $LJHOME<br />
cp doc/config-private.pl.txt etc/config-private.pl<br />
chmod go-rwx etc/config-private.pl<br />
vim etc/config-private.pl<br />
<br />
In this file, uncomment the lines in the <var>%DBINFO</var> blocks (if they are commented out), and place your database password in quotes on the "pass => ," line, before the comma. For example:<br />
<br />
%DBINFO = (<br />
master => {<br />
pass => 'mypassword',<br />
},<br />
);<br />
<br />
Note that there are two DBINFO blocks; get them both.<br />
<br />
The base configuration file is under source control, and is already in <tt>etc/config.pl</tt>. You should not need to change anything very much in this, but you might have to change some stuff. If you find you do have to touch this, please see [http://bugs.dwscoalition.org/show_bug.cgi?id=165] first. Then you can edit it:<br />
<br />
vim etc/config.pl<br />
<br />
== Make sure things are working with checkconfig.pl ==<br />
<br />
Now, you need to see if everything is working. <br />
<br />
If you've setup the files as indicated above, run this command:<br />
<br />
cd $LJHOME<br />
bin/checkconfig.pl --no=ljconfig<br />
<br />
If you installed everything given at the top of this page, you should find you have no missing modules. Congratulations! If you don't have all the modules, this is where you need some systems specific knowledge for your system. You will need to install whatever modules are missing. If you get well and truly stuck, find someone on IRC or the mailing list.<br />
<br />
== Populate database with initial data ==<br />
<br />
There are a few commands you can now run to install the database. Just run these and watch for errors.<br />
<br />
<b>Note:</b> If make_system.pl says it can't give the system user admin privileges, something has gone wrong with your database population, even if there were no errors.<br />
<br />
$LJHOME/bin/upgrading/update-db.pl -r --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -p<br />
<br />
(That step will ask you for a password for the system account. You can change it later by logging in as system, so just give it something for now.)<br />
<br />
$LJHOME/bin/upgrading/make_system.pl<br />
$LJHOME/bin/upgrading/texttool.pl load<br />
<br />
== Configure Apache ==<br />
<br />
This step will need to be done as the root user. Below is the Apache 2 configuration running on the Dreamwidth staging site. Put this in a file named "stage" in /etc/apache2/conf.d:<br />
<br />
User dw<br />
Group dw<br />
UseCanonicalName off<br />
<br />
StartServers 1<br />
MaxSpareServers 2<br />
MinSpareServers 1<br />
<br />
DocumentRoot /home/dw/htdocs<br />
<br />
PerlSetEnv LJHOME /home/dw<br />
PerlPassEnv LJHOME<br />
<br />
PerlRequire /home/dw/cgi-bin/modperl.pl<br />
<br />
Then disable the default site:<br />
<br />
a2dissite default<br />
<br />
You might also have to enable the Perl Apache Request module:<br />
<br />
a2enmod apreq<br />
<br />
If you don't want this warning:<br />
<br />
[Thu Jan 15 01:46:54 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
... waiting [Thu Jan 15 01:46:55 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
...done.<br />
<br />
Then use <code>vim /etc/apache2/ports.conf</code> and put a # in front of the NameVirtualHost line:<br />
<br />
# NameVirtualHost *:80<br />
<br />
Restart the server:<br />
<br />
/etc/init.d/apache2 restart<br />
<br />
== Now what? ==<br />
<br />
=== Have a look at your new DW instance ===<br />
<br />
Congratulations! You now have a working (though minimal) Dreamwidth install. If you point your web browser at your server, you should see a bare-looking welcome page.<br />
<br />
=== Further setup ===<br />
<br />
There are lots of other articles on setting up and customizing your DW install in the [[:Category: Dreamwidth Installation|DW Installation]] category, including:<br />
<br />
* [[TheSchwartz Setup]] - TheSchwartz is needed for a handful of features - notably comment posting<br />
* [[Subdomain setup]]<br />
* [[Statistics setup]]<br />
* [[Generating documentation]]<br />
* [[Allow users to register]]<br />
<br />
There is a list of wanted how-tos at [[Installation Wanted How-To]], in case you need to add something to the list.<br />
<br />
=== Starting development ===<br />
<br />
The list of things that need doing are in [http://bugs.dwscoalition.org/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailqa_contact2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfie Bugzilla]. You can keep your code update with the instructions in [[Dev Maintenance]]. Instructions on submitting patches are in [[Dev Patches]].<br />
<br />
[[Category: Dreamwidth Installation]]</div>Vass//wiki.dreamwidth.net/wiki/index.php/Dreamwidth_Scratch_InstallationDreamwidth Scratch Installation2010-04-05T13:00:48Z<p>Vass: /* Installing necessary packages */</p>
<hr />
<div>These are the instructions to install a Dreamwidth system from scratch, assuming you are running Ubuntu 9.04. Please note that the server currently segfaults under Ubuntu 9.10 setups. See [[Setting up Dreamwidth on Linode]] for instructions on setting up a system to the point where you can log in and start this. After you set up, you can keep updated with the instructions on [[Dev Maintenance]].<br />
<br />
If you have difficulties or problems or suggestions for installation procedures, please report them to [http://www.dwscoalition.org/show_bug.cgi?id=61 Bug 61]. Also look at [[Production Setup: Webserver]]. <br />
<br />
== Bringing the system up to date ==<br />
<br />
Before you start installing anything else, you might want to make sure your system is up to date. You should log in as root and update the packages on your system:<br />
<br />
apt-get update<br />
apt-get upgrade<br />
<br />
If you want man pages on your system: <br />
<br />
apt-get install man<br />
<br />
== Installing necessary packages ==<br />
<br />
This will install necessary packages you'll need to run Dreamwidth (and some optional ones). You'll want to be root when running these commands.<br />
<br />
apt-get install mercurial subversion apache2-mpm-prefork \<br />
libapache2-mod-perl2 libapache2-mod-apreq2 libapache2-request-perl \<br />
mysql-server wget unzip links vim libclass-autouse-perl \<br />
libcompress-zlib-perl libdatetime-perl libdigest-sha1-perl \<br />
libgd-gd2-perl libhtml-template-perl libwww-perl libmime-lite-perl \<br />
libnet-dns-perl liburi-perl libxml-simple-perl libclass-accessor-perl \<br />
libclass-data-inheritable-perl libclass-trigger-perl libcrypt-dh-perl \<br />
libmath-bigint-gmp-perl liburi-fetch-perl libgd-graph-perl \<br />
libgnupg-interface-perl libmail-gnupg-perl perlmagick \<br />
libproc-processtable-perl libsoap-lite-perl librpc-xml-perl \<br />
libstring-crc32-perl libtext-vcard-perl libxml-atom-perl libxml-rss-perl \<br />
libimage-size-perl libunicode-maputf8-perl libgtop2-dev build-essential \<br />
libnet-openid-consumer-perl libnet-openid-server-perl libyaml-perl \<br />
libcaptcha-recaptcha-perl libdbd-sqlite3-perl libtest-simple-perl \<br />
libtest-simpleunit-perl libtemplate-perl libterm-readkey-perl \<br />
libextutils-cbuilder-perl<br />
<br />
This will download about 123MB of files and use around 446MB of disk space.<br />
<br />
Check whether these packages have actually installed. Later on in the process, if you find you are having inexplicable problems, try installing these again.<br />
<br />
[http://perl.apache.org/docs/2.0/user/install/install.html#Prerequisites Check] whether your system is using threaded MPMs or pre-fork. You will need the latter.<br />
<br />
If you have weird errors saying things like "Package mercurial is not available, but is referred to by another package.", try editing <tt>/etc/apt/sources.list</tt> and uncommenting the other repositories and then doing an <tt>apt-get</tt> update. Ran into this problem on a fresh install of <tt>jaunty</tt> on Linode.<br />
<br />
You will also want to install some perl libraries with CPAN. Defaults during CPAN's setup should be okay.<br />
<br />
Before installing, check if your CPAN shell has 'make' at the correct location. Run <tt>which make</tt>, then compare the results with running <tt>o conf make</tt> at the CPAN shell (to run the CPAN shell, type <tt>CPAN</tt>.)<br />
<br />
The perl libraries are:<br />
<br />
perl -MCPAN -e 'install Bundle::CPAN'<br />
perl -MCPAN -e 'install GTop' # this will guide you through setting up CPAN<br />
perl -MCPAN -e 'install Unicode::CheckUTF8'<br />
perl -MCPAN -e 'install Captcha::reCAPTCHA'<br />
perl -MCPAN -e 'install IP::Country::Fast'<br />
perl -MCPAN -e 'install Google::Checkout::General::GCO'<br />
<br />
You will also want to install and configure Postfix so your DW can send out email:<br />
<br />
apt-get install postfix<br />
<br />
If you choose not to configure on the install, you can do so later with:<br />
<br />
dpkg-reconfigure postfix<br />
<br />
== Setting up the DW user account ==<br />
<br />
{{Note|text=If you still find yourself unable to make sudo commands even after <code>usermod</code>, please see [[Making your DW user a sudo account]] for alternatives.}} Create a user account that will be used for the code. This can be your own personal account if you wish, but it is recommended that you setup a new user that is only going to be used for running the code. That way if you have any insecure code running (i.e., a bad page, or a patch you're working on doesn't have security implemented yet) you don't have to worry about someone getting access to your personal files.<br />
<br />
To set up the user account:<br />
<br />
adduser <i>username</i><br />
<br />
Fill out the user's info and put them in the sudo group:<br />
<br />
usermod -a -G sudo <i>username</i><br />
<br />
So, to use <code>dw</code> as a username:<br />
<br />
adduser dw<br />
usermod -a -G sudo dw<br />
<br />
Now, we will get the $LJHOME variable set. Log into your user:<br />
<br />
su - dw<br />
<br />
We will assume that you use the bash shell. If you do not, then this section does not apply. You will have to find the shell specific way of setting environment variables.<br />
<br />
For bash, you should look in the home directory of the user account you just created for a file .profile. You will want to add one more line to this file:<br />
<br />
export LJHOME=/home/dw<br />
<br />
Or whatever your user account's home directory is. Yes, the variable is named LJHOME. We'll live with it for now. ;-)<br />
<br />
Test this. Log out of your user account and log back in, then type:<br />
<br />
echo $LJHOME<br />
<br />
You should see /home/dw or whatever you set it to. If you don't, then you didn't get the export line in the right place. (Hey, I'm not here to teach basic sysadmin stuff. You should know how to set environment variables.)<br />
<br />
== Downloading the Dreamwidth code ==<br />
<br />
You should do this as the user you want to run Dreamwidth as. If you are root, you can switch with:<br />
<br />
su - dw<br />
<br />
We have put together a bootstrap script that will download all of the code. You can obtain this file with your favorite tool (wget, curl, etc):<br />
<br />
wget http://hg.dwscoalition.org/dw-free/raw-file/tip/bin/bootstrap.pl<br />
<br />
The next step is fairly automatic. Assuming that your $LJHOME environment variable is good to go, you should be able to just do this:<br />
<br />
perl bootstrap.pl<br />
<br />
The script will start doing some work. It should start out by saying 'seems we need to start at the beginning', which is what you expect. Then you will sit around for half an hour while it checks out various packages and repositories from various locations.<br />
<br />
When it's done, it will say so. It will also say to delete the bootstrap script: <br />
<br />
rm bootstrap.pl<br />
<br />
Do a quick ls in $LJHOME to see if you have a bunch of new directories like cvs, cgi-bin, htdocs, etc. If you do, huzzah! You now have the code checked out.<br />
<br />
If you don't, figure out what step didn't work, and try again. All else fails, hit the mailing list or find someone on IRC.<br />
<br />
=== dw-nonfree ===<br />
<br />
{{Warn|text=This should not be used on installations that are not Dreamwidth development installations.}} <br />
<br />
If you are doing development on Dreamwidth custom files (what few there are), then you will need to do another step. This is fairly manual, the bootstrap script does not handle this process for you. But assuming that you did the above steps, you can get dw-nonfree code like this:<br />
<br />
cd $LJHOME/cvs<br />
hg clone http://hg.dwscoalition.org/dw-nonfree dw-nonfree<br />
cp dw-nonfree/cvs/multicvs-local.conf .<br />
<br />
You may want to look at [[Keeping your site configs from wiping during updates]] if you want to keep your config files from getting wiped during subsequent updates if you're using <tt>dw-nonfree</tt>.<br />
<br />
=== Updating to the tip ===<br />
<br />
As of right now, you have the code that existed up until the end of the initial branch with no name, ending in changeset [http://hg.dwscoalition.org/dw-free/rev/1defc551af6c 1defc551af6c] from October 13th 2008. However, with the next commit on January 14th 2009, named branches were introduced, and the dw-free repository now uses all named branches. (currently there is only one named branch that is up to date, 'production')<br />
<br />
Right now, bootstrap.pl gives you the SVN repository, rather than an HG which is currently used and as such cvsreport.pl fails because it expected HG.<br />
<br />
Remove it and then do checkout:<br />
<br />
cd $LJHOME/cvs/dw-free<br />
hg update -C tip<br />
cd $LJHOME<br />
bin/cvsreport.pl -sync -cvsonly<br />
rm -rf cvs/perlbal/<br />
rm -rf cvs/js/<br />
bin/cvsreport.pl --checkout<br />
bin/cvsreport.pl -sync -cvsonly<br />
<br />
<br />
You need to do the last line twice, since the multicvs.conf file has changed since then. Any future updates should now work as described on the [[Dev Maintenance]] page. You will also want to delete files that no longer exist in the repository:<br />
<br />
<source lang="bash">cd $LJHOME; for i in `bin/cvsreport.pl -n -1`; do echo "Removing $i" && rm $i; done</source><br />
<br />
== Database setup ==<br />
<br />
You should have a local MySQL installation and know the root login to the database. To sign into MySQL as root:<br />
<br />
mysql -u root -p <br />
<br />
These MySQL commands wil create your development database:<br />
<br />
create database dw;<br />
grant all on dw.* to 'dw'@'localhost' identified by 'somePassword';<br />
quit;<br />
<br />
You might want to pick a more appropriate database username/database name/password.<br />
<br />
== Editing the config files ==<br />
<br />
Next you need to configure the site configuration scripts. This is probably the most tricky part of the whole process, since there are so many things you can tweak. However, you can get by with just tweaking etc/config-local.pl and etc/config-private.pl for now:<br />
<br />
cd $LJHOME<br />
cp doc/config-local.pl.txt etc/config-local.pl<br />
vim etc/config-local.pl<br />
<br />
Or use your editor of choice, of course. Do a search for the phrase 'CHANGE THIS' which occurs once, before the block of human readable text you should use to describe your development installation.<br />
<br />
Note that the <var>$IS_DEV_SERVER</var> flag is set to 1 in the template given. Be sure to set this to 0 for a production site, as there are big security issues involved with leaving the flag set to 1. <br />
<br />
Next, you need to change your local variables in the <tt>config-private.pl</tt> file. This is where your passwords are configured, as well as many of the variables which define your domain. Do a search for the phrase 'CHANGETHIS'(note the slightly different spacing). You will want to change at least your <var>$DOMAIN</var> and the <var>%DBINFO</var> structure.<br />
<br />
cd $LJHOME<br />
cp doc/config-private.pl.txt etc/config-private.pl<br />
chmod go-rwx etc/config-private.pl<br />
vim etc/config-private.pl<br />
<br />
In this file, uncomment the lines in the <var>%DBINFO</var> blocks (if they are commented out), and place your database password in quotes on the "pass => ," line, before the comma. For example:<br />
<br />
%DBINFO = (<br />
master => {<br />
pass => 'mypassword',<br />
},<br />
);<br />
<br />
Note that there are two DBINFO blocks; get them both.<br />
<br />
The base configuration file is under source control, and is already in <tt>etc/config.pl</tt>. You should not need to change anything very much in this, but you might have to change some stuff. If you find you do have to touch this, please see [http://bugs.dwscoalition.org/show_bug.cgi?id=165] first. Then you can edit it:<br />
<br />
vim etc/config.pl<br />
<br />
== Make sure things are working with checkconfig.pl ==<br />
<br />
Now, you need to see if everything is working. <br />
<br />
If you've setup the files as indicated above, run this command:<br />
<br />
cd $LJHOME<br />
bin/checkconfig.pl --no=ljconfig<br />
<br />
If you installed everything given at the top of this page, you should find you have no missing modules. Congratulations! If you don't have all the modules, this is where you need some systems specific knowledge for your system. You will need to install whatever modules are missing. If you get well and truly stuck, find someone on IRC or the mailing list.<br />
<br />
== Populate database with initial data ==<br />
<br />
There are a few commands you can now run to install the database. Just run these and watch for errors.<br />
<br />
<b>Note:</b> If make_system.pl says it can't give the system user admin privileges, something has gone wrong with your database population, even if there were no errors.<br />
<br />
$LJHOME/bin/upgrading/update-db.pl -r --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -p<br />
<br />
(That step will ask you for a password for the system account. You can change it later by logging in as system, so just give it something for now.)<br />
<br />
$LJHOME/bin/upgrading/make_system.pl<br />
$LJHOME/bin/upgrading/texttool.pl load<br />
<br />
== Configure Apache ==<br />
<br />
This step will need to be done as the root user. Below is the Apache 2 configuration running on the Dreamwidth staging site. Put this in a file named "stage" in /etc/apache2/conf.d:<br />
<br />
User dw<br />
Group dw<br />
UseCanonicalName off<br />
<br />
StartServers 1<br />
MaxSpareServers 2<br />
MinSpareServers 1<br />
<br />
DocumentRoot /home/dw/htdocs<br />
<br />
PerlSetEnv LJHOME /home/dw<br />
PerlPassEnv LJHOME<br />
<br />
PerlRequire /home/dw/cgi-bin/modperl.pl<br />
<br />
Then disable the default site:<br />
<br />
a2dissite default<br />
<br />
You might also have to enable the Perl Apache Request module:<br />
<br />
a2enmod apreq<br />
<br />
If you don't want this warning:<br />
<br />
[Thu Jan 15 01:46:54 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
... waiting [Thu Jan 15 01:46:55 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
...done.<br />
<br />
Then use <code>vim /etc/apache2/ports.conf</code> and put a # in front of the NameVirtualHost line:<br />
<br />
# NameVirtualHost *:80<br />
<br />
Restart the server:<br />
<br />
/etc/init.d/apache2 restart<br />
<br />
== Now what? ==<br />
<br />
=== Have a look at your new DW instance ===<br />
<br />
Congratulations! You now have a working (though minimal) Dreamwidth install. If you point your web browser at your server, you should see a bare-looking welcome page.<br />
<br />
=== Further setup ===<br />
<br />
There are lots of other articles on setting up and customizing your DW install in the [[:Category: Dreamwidth Installation|DW Installation]] category, including:<br />
<br />
* [[TheSchwartz Setup]] - TheSchwartz is needed for a handful of features - notably comment posting<br />
* [[Subdomain setup]]<br />
* [[Statistics setup]]<br />
* [[Generating documentation]]<br />
* [[Allow users to register]]<br />
<br />
There is a list of wanted how-tos at [[Installation Wanted How-To]], in case you need to add something to the list.<br />
<br />
=== Starting development ===<br />
<br />
The list of things that need doing are in [http://bugs.dwscoalition.org/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailqa_contact2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfie Bugzilla]. You can keep your code update with the instructions in [[Dev Maintenance]]. Instructions on submitting patches are in [[Dev Patches]].<br />
<br />
[[Category: Dreamwidth Installation]]</div>Vass//wiki.dreamwidth.net/wiki/index.php/Dreamwidth_Scratch_InstallationDreamwidth Scratch Installation2010-04-05T12:58:07Z<p>Vass: /* Installing necessary packages */</p>
<hr />
<div>These are the instructions to install a Dreamwidth system from scratch, assuming you are running Ubuntu 9.04. Please note that the server currently segfaults under Ubuntu 9.10 setups. See [[Setting up Dreamwidth on Linode]] for instructions on setting up a system to the point where you can log in and start this. After you set up, you can keep updated with the instructions on [[Dev Maintenance]].<br />
<br />
If you have difficulties or problems or suggestions for installation procedures, please report them to [http://www.dwscoalition.org/show_bug.cgi?id=61 Bug 61]. Also look at [[Production Setup: Webserver]]. <br />
<br />
== Bringing the system up to date ==<br />
<br />
Before you start installing anything else, you might want to make sure your system is up to date. You should log in as root and update the packages on your system:<br />
<br />
apt-get update<br />
apt-get upgrade<br />
<br />
If you want man pages on your system: <br />
<br />
apt-get install man<br />
<br />
== Installing necessary packages ==<br />
<br />
This will install necessary packages you'll need to run Dreamwidth (and some optional ones). You'll want to be root when running these commands.<br />
<br />
apt-get install mercurial subversion apache2-mpm-prefork \<br />
libapache2-mod-perl2 libapache2-mod-apreq2 libapache2-request-perl \<br />
mysql-server wget unzip links vim libclass-autouse-perl \<br />
libcompress-zlib-perl libdatetime-perl libdigest-sha1-perl \<br />
libgd-gd2-perl libhtml-template-perl libwww-perl libmime-lite-perl \<br />
libnet-dns-perl liburi-perl libxml-simple-perl libclass-accessor-perl \<br />
libclass-data-inheritable-perl libclass-trigger-perl libcrypt-dh-perl \<br />
libmath-bigint-gmp-perl liburi-fetch-perl libgd-graph-perl \<br />
libgnupg-interface-perl libmail-gnupg-perl perlmagick \<br />
libproc-processtable-perl libsoap-lite-perl librpc-xml-perl \<br />
libstring-crc32-perl libtext-vcard-perl libxml-atom-perl libxml-rss-perl \<br />
libimage-size-perl libunicode-maputf8-perl libgtop2-dev build-essential \<br />
libnet-openid-consumer-perl libnet-openid-server-perl libyaml-perl \<br />
libcaptcha-recaptcha-perl libdbd-sqlite3-perl libtest-simple-perl \<br />
libtest-simpleunit-perl libtemplate-perl<br />
<br />
This will download about 123MB of files and use around 446MB of disk space.<br />
<br />
Check whether these packages have actually installed. Later on in the process, if you find you are having inexplicable problems, try installing these again.<br />
<br />
[http://perl.apache.org/docs/2.0/user/install/install.html#Prerequisites Check] whether your system is using threaded MPMs or pre-fork. You will need the latter.<br />
<br />
If you have weird errors saying things like "Package mercurial is not available, but is referred to by another package.", try editing <tt>/etc/apt/sources.list</tt> and uncommenting the other repositories and then doing an <tt>apt-get</tt> update. Ran into this problem on a fresh install of <tt>jaunty</tt> on Linode.<br />
<br />
You will also want to install some perl libraries with CPAN. Defaults during CPAN's setup should be okay.<br />
<br />
Before installing, check if your CPAN shell has 'make' at the correct location. Run <tt>which make</tt>, then compare the results with running <tt>o conf make</tt> at the CPAN shell (to run the CPAN shell, type <tt>CPAN</tt>.)<br />
<br />
The perl libraries are:<br />
<br />
perl -MCPAN -e 'install Bundle::CPAN'<br />
perl -MCPAN -e 'install GTop' # this will guide you through setting up CPAN<br />
perl -MCPAN -e 'install Unicode::CheckUTF8'<br />
perl -MCPAN -e 'install Captcha::reCAPTCHA'<br />
perl -MCPAN -e 'install IP::Country::Fast'<br />
perl -MCPAN -e 'install Google::Checkout::General::GCO'<br />
<br />
You will also want to install and configure Postfix so your DW can send out email:<br />
<br />
apt-get install postfix<br />
<br />
If you choose not to configure on the install, you can do so later with:<br />
<br />
dpkg-reconfigure postfix<br />
<br />
== Setting up the DW user account ==<br />
<br />
{{Note|text=If you still find yourself unable to make sudo commands even after <code>usermod</code>, please see [[Making your DW user a sudo account]] for alternatives.}} Create a user account that will be used for the code. This can be your own personal account if you wish, but it is recommended that you setup a new user that is only going to be used for running the code. That way if you have any insecure code running (i.e., a bad page, or a patch you're working on doesn't have security implemented yet) you don't have to worry about someone getting access to your personal files.<br />
<br />
To set up the user account:<br />
<br />
adduser <i>username</i><br />
<br />
Fill out the user's info and put them in the sudo group:<br />
<br />
usermod -a -G sudo <i>username</i><br />
<br />
So, to use <code>dw</code> as a username:<br />
<br />
adduser dw<br />
usermod -a -G sudo dw<br />
<br />
Now, we will get the $LJHOME variable set. Log into your user:<br />
<br />
su - dw<br />
<br />
We will assume that you use the bash shell. If you do not, then this section does not apply. You will have to find the shell specific way of setting environment variables.<br />
<br />
For bash, you should look in the home directory of the user account you just created for a file .profile. You will want to add one more line to this file:<br />
<br />
export LJHOME=/home/dw<br />
<br />
Or whatever your user account's home directory is. Yes, the variable is named LJHOME. We'll live with it for now. ;-)<br />
<br />
Test this. Log out of your user account and log back in, then type:<br />
<br />
echo $LJHOME<br />
<br />
You should see /home/dw or whatever you set it to. If you don't, then you didn't get the export line in the right place. (Hey, I'm not here to teach basic sysadmin stuff. You should know how to set environment variables.)<br />
<br />
== Downloading the Dreamwidth code ==<br />
<br />
You should do this as the user you want to run Dreamwidth as. If you are root, you can switch with:<br />
<br />
su - dw<br />
<br />
We have put together a bootstrap script that will download all of the code. You can obtain this file with your favorite tool (wget, curl, etc):<br />
<br />
wget http://hg.dwscoalition.org/dw-free/raw-file/tip/bin/bootstrap.pl<br />
<br />
The next step is fairly automatic. Assuming that your $LJHOME environment variable is good to go, you should be able to just do this:<br />
<br />
perl bootstrap.pl<br />
<br />
The script will start doing some work. It should start out by saying 'seems we need to start at the beginning', which is what you expect. Then you will sit around for half an hour while it checks out various packages and repositories from various locations.<br />
<br />
When it's done, it will say so. It will also say to delete the bootstrap script: <br />
<br />
rm bootstrap.pl<br />
<br />
Do a quick ls in $LJHOME to see if you have a bunch of new directories like cvs, cgi-bin, htdocs, etc. If you do, huzzah! You now have the code checked out.<br />
<br />
If you don't, figure out what step didn't work, and try again. All else fails, hit the mailing list or find someone on IRC.<br />
<br />
=== dw-nonfree ===<br />
<br />
{{Warn|text=This should not be used on installations that are not Dreamwidth development installations.}} <br />
<br />
If you are doing development on Dreamwidth custom files (what few there are), then you will need to do another step. This is fairly manual, the bootstrap script does not handle this process for you. But assuming that you did the above steps, you can get dw-nonfree code like this:<br />
<br />
cd $LJHOME/cvs<br />
hg clone http://hg.dwscoalition.org/dw-nonfree dw-nonfree<br />
cp dw-nonfree/cvs/multicvs-local.conf .<br />
<br />
You may want to look at [[Keeping your site configs from wiping during updates]] if you want to keep your config files from getting wiped during subsequent updates if you're using <tt>dw-nonfree</tt>.<br />
<br />
=== Updating to the tip ===<br />
<br />
As of right now, you have the code that existed up until the end of the initial branch with no name, ending in changeset [http://hg.dwscoalition.org/dw-free/rev/1defc551af6c 1defc551af6c] from October 13th 2008. However, with the next commit on January 14th 2009, named branches were introduced, and the dw-free repository now uses all named branches. (currently there is only one named branch that is up to date, 'production')<br />
<br />
Right now, bootstrap.pl gives you the SVN repository, rather than an HG which is currently used and as such cvsreport.pl fails because it expected HG.<br />
<br />
Remove it and then do checkout:<br />
<br />
cd $LJHOME/cvs/dw-free<br />
hg update -C tip<br />
cd $LJHOME<br />
bin/cvsreport.pl -sync -cvsonly<br />
rm -rf cvs/perlbal/<br />
rm -rf cvs/js/<br />
bin/cvsreport.pl --checkout<br />
bin/cvsreport.pl -sync -cvsonly<br />
<br />
<br />
You need to do the last line twice, since the multicvs.conf file has changed since then. Any future updates should now work as described on the [[Dev Maintenance]] page. You will also want to delete files that no longer exist in the repository:<br />
<br />
<source lang="bash">cd $LJHOME; for i in `bin/cvsreport.pl -n -1`; do echo "Removing $i" && rm $i; done</source><br />
<br />
== Database setup ==<br />
<br />
You should have a local MySQL installation and know the root login to the database. To sign into MySQL as root:<br />
<br />
mysql -u root -p <br />
<br />
These MySQL commands wil create your development database:<br />
<br />
create database dw;<br />
grant all on dw.* to 'dw'@'localhost' identified by 'somePassword';<br />
quit;<br />
<br />
You might want to pick a more appropriate database username/database name/password.<br />
<br />
== Editing the config files ==<br />
<br />
Next you need to configure the site configuration scripts. This is probably the most tricky part of the whole process, since there are so many things you can tweak. However, you can get by with just tweaking etc/config-local.pl and etc/config-private.pl for now:<br />
<br />
cd $LJHOME<br />
cp doc/config-local.pl.txt etc/config-local.pl<br />
vim etc/config-local.pl<br />
<br />
Or use your editor of choice, of course. Do a search for the phrase 'CHANGE THIS' which occurs once, before the block of human readable text you should use to describe your development installation.<br />
<br />
Note that the <var>$IS_DEV_SERVER</var> flag is set to 1 in the template given. Be sure to set this to 0 for a production site, as there are big security issues involved with leaving the flag set to 1. <br />
<br />
Next, you need to change your local variables in the <tt>config-private.pl</tt> file. This is where your passwords are configured, as well as many of the variables which define your domain. Do a search for the phrase 'CHANGETHIS'(note the slightly different spacing). You will want to change at least your <var>$DOMAIN</var> and the <var>%DBINFO</var> structure.<br />
<br />
cd $LJHOME<br />
cp doc/config-private.pl.txt etc/config-private.pl<br />
chmod go-rwx etc/config-private.pl<br />
vim etc/config-private.pl<br />
<br />
In this file, uncomment the lines in the <var>%DBINFO</var> blocks (if they are commented out), and place your database password in quotes on the "pass => ," line, before the comma. For example:<br />
<br />
%DBINFO = (<br />
master => {<br />
pass => 'mypassword',<br />
},<br />
);<br />
<br />
Note that there are two DBINFO blocks; get them both.<br />
<br />
The base configuration file is under source control, and is already in <tt>etc/config.pl</tt>. You should not need to change anything very much in this, but you might have to change some stuff. If you find you do have to touch this, please see [http://bugs.dwscoalition.org/show_bug.cgi?id=165] first. Then you can edit it:<br />
<br />
vim etc/config.pl<br />
<br />
== Make sure things are working with checkconfig.pl ==<br />
<br />
Now, you need to see if everything is working. <br />
<br />
If you've setup the files as indicated above, run this command:<br />
<br />
cd $LJHOME<br />
bin/checkconfig.pl --no=ljconfig<br />
<br />
If you installed everything given at the top of this page, you should find you have no missing modules. Congratulations! If you don't have all the modules, this is where you need some systems specific knowledge for your system. You will need to install whatever modules are missing. If you get well and truly stuck, find someone on IRC or the mailing list.<br />
<br />
== Populate database with initial data ==<br />
<br />
There are a few commands you can now run to install the database. Just run these and watch for errors.<br />
<br />
<b>Note:</b> If make_system.pl says it can't give the system user admin privileges, something has gone wrong with your database population, even if there were no errors.<br />
<br />
$LJHOME/bin/upgrading/update-db.pl -r --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -p<br />
<br />
(That step will ask you for a password for the system account. You can change it later by logging in as system, so just give it something for now.)<br />
<br />
$LJHOME/bin/upgrading/make_system.pl<br />
$LJHOME/bin/upgrading/texttool.pl load<br />
<br />
== Configure Apache ==<br />
<br />
This step will need to be done as the root user. Below is the Apache 2 configuration running on the Dreamwidth staging site. Put this in a file named "stage" in /etc/apache2/conf.d:<br />
<br />
User dw<br />
Group dw<br />
UseCanonicalName off<br />
<br />
StartServers 1<br />
MaxSpareServers 2<br />
MinSpareServers 1<br />
<br />
DocumentRoot /home/dw/htdocs<br />
<br />
PerlSetEnv LJHOME /home/dw<br />
PerlPassEnv LJHOME<br />
<br />
PerlRequire /home/dw/cgi-bin/modperl.pl<br />
<br />
Then disable the default site:<br />
<br />
a2dissite default<br />
<br />
You might also have to enable the Perl Apache Request module:<br />
<br />
a2enmod apreq<br />
<br />
If you don't want this warning:<br />
<br />
[Thu Jan 15 01:46:54 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
... waiting [Thu Jan 15 01:46:55 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
...done.<br />
<br />
Then use <code>vim /etc/apache2/ports.conf</code> and put a # in front of the NameVirtualHost line:<br />
<br />
# NameVirtualHost *:80<br />
<br />
Restart the server:<br />
<br />
/etc/init.d/apache2 restart<br />
<br />
== Now what? ==<br />
<br />
=== Have a look at your new DW instance ===<br />
<br />
Congratulations! You now have a working (though minimal) Dreamwidth install. If you point your web browser at your server, you should see a bare-looking welcome page.<br />
<br />
=== Further setup ===<br />
<br />
There are lots of other articles on setting up and customizing your DW install in the [[:Category: Dreamwidth Installation|DW Installation]] category, including:<br />
<br />
* [[TheSchwartz Setup]] - TheSchwartz is needed for a handful of features - notably comment posting<br />
* [[Subdomain setup]]<br />
* [[Statistics setup]]<br />
* [[Generating documentation]]<br />
* [[Allow users to register]]<br />
<br />
There is a list of wanted how-tos at [[Installation Wanted How-To]], in case you need to add something to the list.<br />
<br />
=== Starting development ===<br />
<br />
The list of things that need doing are in [http://bugs.dwscoalition.org/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailqa_contact2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfie Bugzilla]. You can keep your code update with the instructions in [[Dev Maintenance]]. Instructions on submitting patches are in [[Dev Patches]].<br />
<br />
[[Category: Dreamwidth Installation]]</div>Vass//wiki.dreamwidth.net/wiki/index.php/Dreamwidth_Scratch_InstallationDreamwidth Scratch Installation2010-04-05T12:32:05Z<p>Vass: /* Installing necessary packages */</p>
<hr />
<div>These are the instructions to install a Dreamwidth system from scratch, assuming you are running Ubuntu 9.04. Please note that the server currently segfaults under Ubuntu 9.10 setups. See [[Setting up Dreamwidth on Linode]] for instructions on setting up a system to the point where you can log in and start this. After you set up, you can keep updated with the instructions on [[Dev Maintenance]].<br />
<br />
If you have difficulties or problems or suggestions for installation procedures, please report them to [http://www.dwscoalition.org/show_bug.cgi?id=61 Bug 61]. Also look at [[Production Setup: Webserver]]. <br />
<br />
== Bringing the system up to date ==<br />
<br />
Before you start installing anything else, you might want to make sure your system is up to date. You should log in as root and update the packages on your system:<br />
<br />
apt-get update<br />
apt-get upgrade<br />
<br />
If you want man pages on your system: <br />
<br />
apt-get install man<br />
<br />
== Installing necessary packages ==<br />
<br />
This will install necessary packages you'll need to run Dreamwidth (and some optional ones). You'll want to be root when running these commands.<br />
<br />
apt-get install mercurial subversion apache2-mpm-prefork \<br />
libapache2-mod-perl2 libapache2-mod-apreq2 libapache2-request-perl \<br />
mysql-server wget unzip links vim libclass-autouse-perl \<br />
libcompress-zlib-perl libdatetime-perl libdigest-sha1-perl \<br />
libgd-gd2-perl libhtml-template-perl libwww-perl libmime-lite-perl \<br />
libnet-dns-perl liburi-perl libxml-simple-perl libclass-accessor-perl \<br />
libclass-data-inheritable-perl libclass-trigger-perl libcrypt-dh-perl \<br />
libmath-bigint-gmp-perl liburi-fetch-perl libgd-graph-perl \<br />
libgnupg-interface-perl libmail-gnupg-perl perlmagick \<br />
libproc-processtable-perl libsoap-lite-perl librpc-xml-perl \<br />
libstring-crc32-perl libtext-vcard-perl libxml-atom-perl libxml-rss-perl \<br />
libimage-size-perl libunicode-maputf8-perl libgtop2-dev build-essential \<br />
libnet-openid-consumer-perl libnet-openid-server-perl libyaml-perl \<br />
libcaptcha-recaptcha-perl libdbd-sqlite3-perl libtest-simple-perl \<br />
libtest-simpleunit-perl libtemplate-perl<br />
<br />
This will download about 123MB of files and use around 446MB of disk space.<br />
<br />
Check whether these packages have actually installed. Later on in the process, if you find you are having inexplicable problems, try installing these again.<br />
<br />
[http://perl.apache.org/docs/2.0/user/install/install.html#Prerequisites Check] whether your system is using threaded MPMs or pre-fork. You will need the latter.<br />
<br />
If you have weird errors saying things like "Package mercurial is not available, but is referred to by another package.", try editing <tt>/etc/apt/sources.list</tt> and uncommenting the other repositories and then doing an <tt>apt-get</tt> update. Ran into this problem on a fresh install of <tt>jaunty</tt> on Linode.<br />
<br />
You will also want to install some perl libraries with CPAN. Defaults during CPAN's setup should be okay:<br />
<br />
perl -MCPAN -e 'install Bundle::CPAN'<br />
perl -MCPAN -e 'install GTop' # this will guide you through setting up CPAN<br />
perl -MCPAN -e 'install Unicode::CheckUTF8'<br />
perl -MCPAN -e 'install Captcha::reCAPTCHA'<br />
perl -MCPAN -e 'install IP::Country::Fast'<br />
perl -MCPAN -e 'install Google::Checkout::General::GCO'<br />
<br />
You will also want to install and configure Postfix so your DW can send out email:<br />
<br />
apt-get install postfix<br />
<br />
If you choose not to configure on the install, you can do so later with:<br />
<br />
dpkg-reconfigure postfix<br />
<br />
== Setting up the DW user account ==<br />
<br />
{{Note|text=If you still find yourself unable to make sudo commands even after <code>usermod</code>, please see [[Making your DW user a sudo account]] for alternatives.}} Create a user account that will be used for the code. This can be your own personal account if you wish, but it is recommended that you setup a new user that is only going to be used for running the code. That way if you have any insecure code running (i.e., a bad page, or a patch you're working on doesn't have security implemented yet) you don't have to worry about someone getting access to your personal files.<br />
<br />
To set up the user account:<br />
<br />
adduser <i>username</i><br />
<br />
Fill out the user's info and put them in the sudo group:<br />
<br />
usermod -a -G sudo <i>username</i><br />
<br />
So, to use <code>dw</code> as a username:<br />
<br />
adduser dw<br />
usermod -a -G sudo dw<br />
<br />
Now, we will get the $LJHOME variable set. Log into your user:<br />
<br />
su - dw<br />
<br />
We will assume that you use the bash shell. If you do not, then this section does not apply. You will have to find the shell specific way of setting environment variables.<br />
<br />
For bash, you should look in the home directory of the user account you just created for a file .profile. You will want to add one more line to this file:<br />
<br />
export LJHOME=/home/dw<br />
<br />
Or whatever your user account's home directory is. Yes, the variable is named LJHOME. We'll live with it for now. ;-)<br />
<br />
Test this. Log out of your user account and log back in, then type:<br />
<br />
echo $LJHOME<br />
<br />
You should see /home/dw or whatever you set it to. If you don't, then you didn't get the export line in the right place. (Hey, I'm not here to teach basic sysadmin stuff. You should know how to set environment variables.)<br />
<br />
== Downloading the Dreamwidth code ==<br />
<br />
You should do this as the user you want to run Dreamwidth as. If you are root, you can switch with:<br />
<br />
su - dw<br />
<br />
We have put together a bootstrap script that will download all of the code. You can obtain this file with your favorite tool (wget, curl, etc):<br />
<br />
wget http://hg.dwscoalition.org/dw-free/raw-file/tip/bin/bootstrap.pl<br />
<br />
The next step is fairly automatic. Assuming that your $LJHOME environment variable is good to go, you should be able to just do this:<br />
<br />
perl bootstrap.pl<br />
<br />
The script will start doing some work. It should start out by saying 'seems we need to start at the beginning', which is what you expect. Then you will sit around for half an hour while it checks out various packages and repositories from various locations.<br />
<br />
When it's done, it will say so. It will also say to delete the bootstrap script: <br />
<br />
rm bootstrap.pl<br />
<br />
Do a quick ls in $LJHOME to see if you have a bunch of new directories like cvs, cgi-bin, htdocs, etc. If you do, huzzah! You now have the code checked out.<br />
<br />
If you don't, figure out what step didn't work, and try again. All else fails, hit the mailing list or find someone on IRC.<br />
<br />
=== dw-nonfree ===<br />
<br />
{{Warn|text=This should not be used on installations that are not Dreamwidth development installations.}} <br />
<br />
If you are doing development on Dreamwidth custom files (what few there are), then you will need to do another step. This is fairly manual, the bootstrap script does not handle this process for you. But assuming that you did the above steps, you can get dw-nonfree code like this:<br />
<br />
cd $LJHOME/cvs<br />
hg clone http://hg.dwscoalition.org/dw-nonfree dw-nonfree<br />
cp dw-nonfree/cvs/multicvs-local.conf .<br />
<br />
You may want to look at [[Keeping your site configs from wiping during updates]] if you want to keep your config files from getting wiped during subsequent updates if you're using <tt>dw-nonfree</tt>.<br />
<br />
=== Updating to the tip ===<br />
<br />
As of right now, you have the code that existed up until the end of the initial branch with no name, ending in changeset [http://hg.dwscoalition.org/dw-free/rev/1defc551af6c 1defc551af6c] from October 13th 2008. However, with the next commit on January 14th 2009, named branches were introduced, and the dw-free repository now uses all named branches. (currently there is only one named branch that is up to date, 'production')<br />
<br />
Right now, bootstrap.pl gives you the SVN repository, rather than an HG which is currently used and as such cvsreport.pl fails because it expected HG.<br />
<br />
Remove it and then do checkout:<br />
<br />
cd $LJHOME/cvs/dw-free<br />
hg update -C tip<br />
cd $LJHOME<br />
bin/cvsreport.pl -sync -cvsonly<br />
rm -rf cvs/perlbal/<br />
rm -rf cvs/js/<br />
bin/cvsreport.pl --checkout<br />
bin/cvsreport.pl -sync -cvsonly<br />
<br />
<br />
You need to do the last line twice, since the multicvs.conf file has changed since then. Any future updates should now work as described on the [[Dev Maintenance]] page. You will also want to delete files that no longer exist in the repository:<br />
<br />
<source lang="bash">cd $LJHOME; for i in `bin/cvsreport.pl -n -1`; do echo "Removing $i" && rm $i; done</source><br />
<br />
== Database setup ==<br />
<br />
You should have a local MySQL installation and know the root login to the database. To sign into MySQL as root:<br />
<br />
mysql -u root -p <br />
<br />
These MySQL commands wil create your development database:<br />
<br />
create database dw;<br />
grant all on dw.* to 'dw'@'localhost' identified by 'somePassword';<br />
quit;<br />
<br />
You might want to pick a more appropriate database username/database name/password.<br />
<br />
== Editing the config files ==<br />
<br />
Next you need to configure the site configuration scripts. This is probably the most tricky part of the whole process, since there are so many things you can tweak. However, you can get by with just tweaking etc/config-local.pl and etc/config-private.pl for now:<br />
<br />
cd $LJHOME<br />
cp doc/config-local.pl.txt etc/config-local.pl<br />
vim etc/config-local.pl<br />
<br />
Or use your editor of choice, of course. Do a search for the phrase 'CHANGE THIS' which occurs once, before the block of human readable text you should use to describe your development installation.<br />
<br />
Note that the <var>$IS_DEV_SERVER</var> flag is set to 1 in the template given. Be sure to set this to 0 for a production site, as there are big security issues involved with leaving the flag set to 1. <br />
<br />
Next, you need to change your local variables in the <tt>config-private.pl</tt> file. This is where your passwords are configured, as well as many of the variables which define your domain. Do a search for the phrase 'CHANGETHIS'(note the slightly different spacing). You will want to change at least your <var>$DOMAIN</var> and the <var>%DBINFO</var> structure.<br />
<br />
cd $LJHOME<br />
cp doc/config-private.pl.txt etc/config-private.pl<br />
chmod go-rwx etc/config-private.pl<br />
vim etc/config-private.pl<br />
<br />
In this file, uncomment the lines in the <var>%DBINFO</var> blocks (if they are commented out), and place your database password in quotes on the "pass => ," line, before the comma. For example:<br />
<br />
%DBINFO = (<br />
master => {<br />
pass => 'mypassword',<br />
},<br />
);<br />
<br />
Note that there are two DBINFO blocks; get them both.<br />
<br />
The base configuration file is under source control, and is already in <tt>etc/config.pl</tt>. You should not need to change anything very much in this, but you might have to change some stuff. If you find you do have to touch this, please see [http://bugs.dwscoalition.org/show_bug.cgi?id=165] first. Then you can edit it:<br />
<br />
vim etc/config.pl<br />
<br />
== Make sure things are working with checkconfig.pl ==<br />
<br />
Now, you need to see if everything is working. <br />
<br />
If you've setup the files as indicated above, run this command:<br />
<br />
cd $LJHOME<br />
bin/checkconfig.pl --no=ljconfig<br />
<br />
If you installed everything given at the top of this page, you should find you have no missing modules. Congratulations! If you don't have all the modules, this is where you need some systems specific knowledge for your system. You will need to install whatever modules are missing. If you get well and truly stuck, find someone on IRC or the mailing list.<br />
<br />
== Populate database with initial data ==<br />
<br />
There are a few commands you can now run to install the database. Just run these and watch for errors.<br />
<br />
<b>Note:</b> If make_system.pl says it can't give the system user admin privileges, something has gone wrong with your database population, even if there were no errors.<br />
<br />
$LJHOME/bin/upgrading/update-db.pl -r --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb<br />
$LJHOME/bin/upgrading/update-db.pl -p<br />
<br />
(That step will ask you for a password for the system account. You can change it later by logging in as system, so just give it something for now.)<br />
<br />
$LJHOME/bin/upgrading/make_system.pl<br />
$LJHOME/bin/upgrading/texttool.pl load<br />
<br />
== Configure Apache ==<br />
<br />
This step will need to be done as the root user. Below is the Apache 2 configuration running on the Dreamwidth staging site. Put this in a file named "stage" in /etc/apache2/conf.d:<br />
<br />
User dw<br />
Group dw<br />
UseCanonicalName off<br />
<br />
StartServers 1<br />
MaxSpareServers 2<br />
MinSpareServers 1<br />
<br />
DocumentRoot /home/dw/htdocs<br />
<br />
PerlSetEnv LJHOME /home/dw<br />
PerlPassEnv LJHOME<br />
<br />
PerlRequire /home/dw/cgi-bin/modperl.pl<br />
<br />
Then disable the default site:<br />
<br />
a2dissite default<br />
<br />
You might also have to enable the Perl Apache Request module:<br />
<br />
a2enmod apreq<br />
<br />
If you don't want this warning:<br />
<br />
[Thu Jan 15 01:46:54 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
... waiting [Thu Jan 15 01:46:55 2009] [warn] NameVirtualHost *:80 has no VirtualHosts<br />
...done.<br />
<br />
Then use <code>vim /etc/apache2/ports.conf</code> and put a # in front of the NameVirtualHost line:<br />
<br />
# NameVirtualHost *:80<br />
<br />
Restart the server:<br />
<br />
/etc/init.d/apache2 restart<br />
<br />
== Now what? ==<br />
<br />
=== Have a look at your new DW instance ===<br />
<br />
Congratulations! You now have a working (though minimal) Dreamwidth install. If you point your web browser at your server, you should see a bare-looking welcome page.<br />
<br />
=== Further setup ===<br />
<br />
There are lots of other articles on setting up and customizing your DW install in the [[:Category: Dreamwidth Installation|DW Installation]] category, including:<br />
<br />
* [[TheSchwartz Setup]] - TheSchwartz is needed for a handful of features - notably comment posting<br />
* [[Subdomain setup]]<br />
* [[Statistics setup]]<br />
* [[Generating documentation]]<br />
* [[Allow users to register]]<br />
<br />
There is a list of wanted how-tos at [[Installation Wanted How-To]], in case you need to add something to the list.<br />
<br />
=== Starting development ===<br />
<br />
The list of things that need doing are in [http://bugs.dwscoalition.org/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailqa_contact2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfie Bugzilla]. You can keep your code update with the instructions in [[Dev Maintenance]]. Instructions on submitting patches are in [[Dev Patches]].<br />
<br />
[[Category: Dreamwidth Installation]]</div>Vass