Difference between revisions of "Dreamwidth Scratch Installation"
Foxfirefey (Talk | contribs) (New page: These are the instructions to install a Dreamwidth system from scratch, assuming you are running Ubuntu. See Setting up Dreamwidth on Linode for instructions on setting up a system to...) |
Foxfirefey (Talk | contribs) m (→Setting up the DW user account) |
||
Line 50: | Line 50: | ||
To set up the user account: | To set up the user account: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
adduser <i>username</i> | adduser <i>username</i> |
Revision as of 07:32, 31 July 2008
These are the instructions to install a Dreamwidth system from scratch, assuming you are running Ubuntu. See Setting up Dreamwidth on Linode for instructions on setting up a system to the point where you can log in and start this.
If you have difficulties or problems or suggestions for installation procedures, please report them to Bug 61.
Contents
Bringing the system up to date
Before you start installing anything else, you might want to make sure your system is up to date:
apt-get update apt-get upgrade
If you want man pages on your system:
apt-get install man
Installing necessary packages
This will install necessary packages you'll need to run Dreamwidth. You'll want to be root when running these commands.
apt-get install mercurial subversion apache2-mpm-prefork \ libapache2-mod-perl2 libapache2-mod-apreq2 libapache2-request-perl \ mysql-server wget unzip links apt-get install libclass-autouse-perl libcompress-zlib-perl \ libdatetime-perl libdigest-sha1-perl libgd-gd2-perl libhtml-template-perl \ libwww-perl libmime-lite-perl libnet-dns-perl liburi-perl libxml-simple-perl apt-get install libclass-accessor-perl libclass-data-inheritable-perl \ libclass-trigger-perl libcrypt-dh-perl libmath-bigint-gmp-perl \ liburi-fetch-perl libgd-graph-perl libgnupg-interface-perl apt-get install libmail-gnupg-perl perlmagick libproc-processtable-perl \ libsoap-lite-perl librpc-xml-perl libstring-crc32-perl libtext-vcard-perl \ libxml-atom-perl libxml-rss-perl apt-get install libimage-size-perl libunicode-maputf8-perl apt-get install libgtop2-dev build-essential perl -MCPAN -e 'install GTop' # this will guide you through setting up CPAN perl -MCPAN -e 'install Unicode::CheckUTF8' perl -MCPAN -e 'install Captcha::reCAPTCHA' perl -MCPAN -e 'install IP::Country::Fast'
You will also want to install and configure Postfix:
apt-get install postfix
If you choose not to configure on the install, you can do so later with:
dpkg-reconfigure postfix
Setting up the DW user account
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.
To set up the user account:
adduser username
Fill out the user's info and put them in the sudo group:
usermod -a -G sudo username
So, to use dw
as a username:
adduser dw usermod -a -G sudo dw
Now, we will get the $LJHOME variable set. Log into your user:
su - dw
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.
For bash, you should look in the home directory of the user account you just created for a file named .bashrc or .bash_profile or maybe even .profile. One of these files will have some commands in it (alias commands usually). You will want to add one more line to this file:
export LJHOME=/home/dw
Or whatever your user account's home directory is. Yes, the variable is named LJHOME. We'll live with it for now. ;-)
Test this. Log out of your user account and log back in, then type:
echo $LJHOME
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.)
Downloading the Dreamwidth code
You should do this as the user you want to run Dreamwidth as. If you are root, you can switch with:
su - dw
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):
wget http://hg.dwscoalition.org/dw-free/raw-file/e4be2e864b95/bin/bootstrap.pl
The next step is fairly automatic. Assuming that your $LJHOME environment variable is good to go, you should be able to just do this:
perl bootstrap.pl
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.
When it's done, it will say so. It will also say to delete the bootstrap script.
rm bootstrap.pl
Do a quick ls in $LJHOME to see if you have a bunch of new directories like cvs, bml, cgi-bin, htdocs, etc. If you do, huzzah! You now have the code checked out.
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.
dw-nonfree
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:
cd $LJHOME/cvs hg clone http://hg.dwscoalition.org/dw-nonfree dw-nonfree cp dw-nonfree/cvs/multicvs-local.conf . cd $LJHOME bin/cvsreport.pl -s
You should see a number of files get copied around.
Database setup
You should have a local MySQL installation and know the root login to the database. To sign into MySQL as root:
mysql -u root -p
These MySQL commands wil create your development database:
create database dw_dev_1; grant all on dw_dev_1.* to 'dw_dev_user'@'localhost' identified by 'somePassword'; quit;
You might want to pick a more appropriate database username/database name/password.
Editing ljconfig.pl
Next you need to configure the site configuration script. This is probably the most tricky part of the whole process, since there are so many things you can tweak. (Note to self: get the DW ljconfig cleaned up and posted...)
cd $LJHOME cp doc/ljconfig.pl.txt etc/ljconfig.pl vim etc/ljconfig.pl
Or use your editor of choice, of course. Do a search for the phrase 'CHANGE THIS' which is in three places. You will want to change at least your $DOMAIN and the %DBINFO structure. It should be fairly self-explanatory.
Note that %DBINFO contains the authentication credentials you chose in the database setup step above!
Make sure things are working with checkconfig.pl
Now, you need to see if everything is working. If you've setup the files as indicated above, run this command:
cd $LJHOME bin/checkconfig.pl --no=ljconfig
It should take a few minutes to run and then tell you that you are missing modules. This is where you need some systems specific knowledge for your system. You will need to install whatever modules it's missing; hopefully with these instructions, none will be. If you get well and truly stuck, find someone on IRC or the mailing list.
Populate database with initial data
There are a few commands you can now run to install the database. Just run these and watch for errors.
Note: 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.
$LJHOME/bin/upgrading/update-db.pl -r --innodb $LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb $LJHOME/bin/upgrading/make_system.pl $LJHOME/bin/upgrading/update-db.pl -p $LJHOME/bin/upgrading/texttool.pl load
(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.)
bin/upgrading/copy-emailpass-out-of-user
Configure Apache
This is the Apache 2 configuration running on the Dreamwidth staging site. I put this in a file named "stage" in /etc/apache2/conf.d, and then I removed the "default" file from /etc/apache2/sites-enabled.
User dw Group dw UseCanonicalName off StartServers 1 MaxSpareServers 2 MinSpareServers 1 DocumentRoot /home/dw/htdocs PerlSetEnv LJHOME /home/dw PerlPassEnv LJHOME PerlRequire /home/dw/cgi-bin/modperl.pl
You might also have to enable the Perl Apache Request module:
a2enmod apreq
Now what?
The list of things that need doing are in Bugzilla. You can keep your code update with the instructions in Dev Maintenance. Instructions on submitting patches are in Dev Patches.