- If you don't already have one (or you want InfluxDB to have its own) Head to the panel and get thyself a VPS!
- Hit the "Configure" button and on the next page, the "Public Keys" link in the "Root SSH Keys" section.
- Create (or upload) a new keypair for your VPS. Safe the private key to your local
~/.ssh/ps123456.rsa
or something. - Head over to the users section and add a new, non-admin user (this example will use
newinfluxdb
). We'll come back to this later.
-
Log in to your VPS as root using something like this:
ssh -i ~/.ssh/ps123456.rsa [email protected]
-
Follow the installation instructions for debian/ubuntu here.
Congratulations! You've installed InfluxDB on your VPS. However, there's one catch left...
Unfortunately, installing InfluxDB from the .deb package provided creates a
user named influxdb
to run the daemon as, and DreamHost's configuration
tools will destroy that user since they don't know about it. So next we have to
tell InfluxDB to use the newinfluxdb
user we created earlier.
-
Find the groupname for your new user:
root@ps392475:~# su -c id newinfluxdb uid=17482136(newinfluxdb) gid=483726(pg2043729) groups=483726(pg2043729)
-
Create
/etc/default/influxdb
and put the following two lines, changing the user and group as appropriate:RUNAS_USER=newinfluxdb RUNAS_GROUP=pg2043729
-
Copy /etc/init.d/influxdb to ~/influxdb.orig in case of trouble and update /etc/init.d/influxdb to match this patch:
root@ps392475:~# diff -u ./influxdb.orig /etc/init.d/influxdb --- ./influxdb.orig 2015-01-09 09:32:27.506643044 -0800 +++ /etc/init.d/influxdb 2015-01-09 09:32:42.937666881 -0800 @@ -39,6 +39,16 @@ STDOUT=/dev/null fi +# If you change either of these, then you'll need to manually chown +# whatever the default user already owns. +if [ "x$RUNAS_USER" == "x" ]; then + RUNAS_USER=influxdb +fi + +if [ "x$RUNAS_GROUP" == "x" ]; then + RUNAS_GROUP=influxdb +fi + echo "Setting ulimit -n $NOFILES" if ! ulimit -n $NOFILES >/dev/null 2>&1; then echo -n "Cannot set the max number of open file descriptors" @@ -113,11 +123,11 @@ # Log the message appropriately cd / if which start-stop-daemon > /dev/null 2>&1; then - nohup start-stop-daemon --chuid influxdb:influxdb -d / --start --quiet --oknodo --pidfile $pidfile --exec $daemon -- -pidfile $pidfile -config $config >> $STDOUT 2>&1 & + nohup start-stop-daemon --chuid ${RUNAS_USER}:${RUNAS_GROUP} -d / --start --quiet --oknodo --pidfile $pidfile --exec $daemon -- -pidfile $pidfile -config $config >> $STDOUT 2>&1 & elif set | egrep '^start_daemon' > /dev/null 2>&1; then - start_daemon -u influxdb ${daemon}-daemon -pidfile $pidfile -config $config >> $STDOUT 2>&1 + start_daemon -u ${RUNAS_USER} ${daemon}-daemon -pidfile $pidfile -config $config >> $STDOUT 2>&1 else - su -s /bin/sh -c "${daemon}-daemon -pidfile $pidfile -config $config >> $STDOUT 2>&1" influxdb + su -s /bin/sh -c "${daemon}-daemon -pidfile $pidfile -config $config >> $STDOUT 2>&1" ${RUNAS_USER} fi log_success_msg "$name process was started" ;;
-
Change the ownership for all the files installed by the package:
-
Note the UID and GID for the old
influxdb
user (both are 998 here):root@ps389191:~# grep influxdb /etc/passwd influxdb:x:998:998::/home/influxdb:/bin/sh
-
Change the owner of all files owned by
influxdb
tonewinfluxdb
(change uid and username as necessary):find / -uid 998 -exec chown newinfluxdb {} +
-
Change the group of all files in the old group (change gid and groupname as necessary):
find / -gid 998 -exec chgrp pg2043729 {} +
-
-
Start the daemon and test it out!
- Start the daemon with
/etc/init.d/influxdb start
- Check it out by pointing your browser to
http://ps123456.dreamhostps.com:8083
- Log in using "root" as both the username and password.
- Click "Cluster Admins" at the top of the page, make a new administrator, and delete the old one.
- Start the daemon with
At this point you have influxdb running on your VPS, and you can connect to it using the IP address assigned to your VPS or the VPS's hostname on the dreamhostps.com domain. However, if you'd like a more friendly DNS name to use that will update automatically when your IP address changes or you get migrated to a different VPS, you should create a domain in DreamHost's panel and host it on the machine.
- Go to the manage domains section of the panel
- Click the "Add Hosting to a Domain / Sub-Domain" button
- Fill in the topmost form ("Fully Hosted"), making sure to host the domain under the user on your influxdb VPS
Just wait for DNS to propagate and you now can access your influxdb installation at the domain or subdomain you hosted on that machine!