OK, let's try this again.
I want a full Debian install with edge CouchDB installed. Yeah, there might be better distros for compiling things, but I really want to stick with with Debian. Debian uses apt-get for package management and you just don't get better than that. More importantly, it is a truly minimal install, which is what you really want for an actual server install. The less there is, the fewer the potential attack vectors.
The problem from yesterday was that I was using stable Debian as the base, but ended up needing to download a ton of junk from testing Debian. Rather than going through all that, why not just start with testing? So I redo my base install steps from the other night, but with testing. The only change is that I select the testing netinst ISO:
The base install for testing takes a long time (1+ hours) on my little netbook. As I did the other night, I ensure that ssh, vim, screen, and sudo are installed before making a backup copy of my base install:
cstrom@whitefall:~/.VirtualBox/HardDisks$ VBoxManage clonehd couch-0.11.vdi debian_testing_base.vdiAgain, I establish SSH port-forwarding on the VM for ease of interaction:
VirtualBox Command Line Management Interface Version 3.0.8_OSE
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: e214e83c-c4de-423b-adec-306435ee69ed
VBoxManage setextradata "couch-0.11" \After booting, I install the necessary software (incorporating lessons learned from last night):
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "couch-0.11" \
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
VBoxManage setextradata "couch-0.11" \
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222
sudo apt-get install \(Update: later installed checkinstall and avahi-daemon)
subversion \
libicu-dev \
libcurl4-gnutls-dev \
erlang \
erlang-dev \
libmozjs-dev \
build-essential \
libtool \
automake \
autoconf
I can then checkout the code and attempt to bootstrap it:
cstrom@couch-011:~$ mkdir reposAwesome! That was so much easier than last night. After running
cstrom@couch-011:~$ cd !$
cd repos
cstrom@couch-011:~/repos$ svn co http://svn.apache.org/repos/asf/couchdb/trunk couchdb
A couchdb/test
...
cstrom@couch-011:~/repos$ cd !$
cd couchdb
cstrom@couch-011:~/repos/couchdb$ ./bootstrap
You have bootstrapped Apache CouchDB, time to relax.
Run `./configure' to configure the source before you install.
./configure
and make
, I can checkinstall
:sudo checkinstallJust as I did last night, I add a couchdb user:
...
**********************************************************************
Done. The new package has been installed and saved to
/home/cstrom/repos/couchdb/couchdb_0.11.999-1-1_i386.deb
You can remove it from your system anytime using:
dpkg -r couchdb
**********************************************************************
cstrom@couch-011:~/repos/couchdb$ sudo adduser --system \And set permissions:
> --home /usr/local/var/lib/couchdb \
> --no-create-home \
> --shell /bin/bash \
> --group --gecos \
> "CouchDB Administrator" couchdb
Adding system user `couchdb' (UID 105) ...
Adding new group `couchdb' (GID 108) ...
Adding new user `couchdb' (UID 105) with group `couchdb' ...
Not creating home directory `/usr/local/var/lib/couchdb'
sudo chown -R couchdb:couchdb /usr/local/etc/couchdbThat gets me a functional CouchDB install:
sudo chown -R couchdb:couchdb /usr/local/var/lib/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/log/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/run/couchdb
cstrom@couch-011:~/repos/couchdb$ sudo -i -u couchdb couchdbTo get that start automatically at boot, I can use the supplied init.d script:
Apache CouchDB 0.12.0a925535 (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.
[info] [<0.32.0>] Apache CouchDB has started on http://127.0.0.1:5984/
cstrom@couch-011:/usr/local/etc/init.d$ sudo /usr/local/etc/init.d/couchdb startTo actually run that a boot time, I add it to the appropriate rc directories with
Starting database server: couchdb.
cstrom@couch-011:/usr/local/etc/init.d$ ps -ef | grep couch
couchdb 10012 1 0 18:54 pts/3 00:00:00 /bin/sh -e /usr/local/bin/couchdb -a /usr/local/etc/couchdb/default.ini -a /usr/local/etc/couchdb/local.ini -b -r 5 -p /usr/local/var/run/couchdb/couchdb.pid -o /dev/null -e /dev/null -R
couchdb 10022 10012 0 18:54 pts/3 00:00:00 /bin/sh -e /usr/local/bin/couchdb -a /usr/local/etc/couchdb/default.ini -a /usr/local/etc/couchdb/local.ini -b -r 5 -p /usr/local/var/run/couchdb/couchdb.pid -o /dev/null -e /dev/null -R
couchdb 10023 10022 8 18:54 pts/3 00:00:00 /usr/lib/erlang/erts-5.7.4/bin/beam -Bd -K true -- -root /usr/lib/erlang -progname erl -- -home /usr/local/var/lib/couchdb -- -noshell -noinput -sasl errlog_type error -couch_ini /usr/local/etc/couchdb/default.ini /usr/local/etc/couchdb/local.ini /usr/local/etc/couchdb/default.ini /usr/local/etc/couchdb/local.ini -s couch -pidfile /usr/local/var/run/couchdb/couchdb.pid -heart
couchdb 10027 10023 0 18:54 ? 00:00:00 heart -pid 10023 -ht 11
cstrom 10031 2269 2 18:54 pts/3 00:00:00 grep couch
update-rc.d
:cstrom@couch-011:/usr/local/etc/init.d$ cd /etc/init.d/The last thing that I do tonight is configure CouchDB to listen on the VM's network interface so that I can access it from outside the VM. This is a simple setting in the
cstrom@couch-011:/etc/init.d$ sudo ln -s /usr/local/etc/init.d/couchdb
cstrom@couch-011:/etc/init.d$ sudo update-rc.d couchdb defaults
update-rc.d: using dependency based boot sequencing
/usr/local/etc/couchdb/local.ini
file:[httpd]As long as avahi (a.k.a. bonjour) is installed, I can now relax on the VM (when run in host-only mode):
;port = 5984
bind_address = 0.0.0.0
I sense much cloning of VMs and fun with replication tomorrow.
Day #37
No comments:
Post a Comment