Setup PureFtp on VPS

After fighting getting this setup on Tuesday and Wednesday I ended up succeeding and didn’t take any notes.  So of course here I am this morning having the exact same problem and trying to go off memory.

Now lets review what has been done so far.  I have had a VPS server imaged with Ubuntu 9.04 32-bit and the installed ISPConfig 3 from this tutorial. http://www.howtoforge.com/perfect-server-ubuntu-9.04-ispconfig-3-p3 (Start at page 3 if you have had your image installed.)

First after you have finished the ISPConfig tutorial go into the /etc/pure-ftpd/db folder and copy the file mysql.conf to a safe directory. I used /root.

This is important because the ISPConfig setup has already configured the file with your database username, password, table to be used, and etc.  So it is easier to copy the file and use it after we have reinstalled PureFTP.

Now if you still have install PureFTP, remove it!

[cc lang=”php”]aptitude purge pure-ftpd-common[/cc]

After you have removed the install you need to pull down the source for the package. (Preferably in /tmp)

[cc lang=”php’]aptitude source pure-ftpd[/cc]

Now cd into the pure-ftpd directory that came in the source package.

Now you should see a file debian/rules.  We want to modify the file in the optflags section to include –without-capabilities, it should look like this.

[cc lang=”php”]optflags=–with-everything –with-largefile –with-pam –with-privsep –with-tls –without-capabilities[/cc]

Now we need to get the dependancies to build the source and compile the installation package.

[cc lang=”php”]aptitude build-dep pure-ftpd[/cc]

[cc lang=”php”]dpkg-buildpackage -uc -b[/cc]

Once this is completed you will have quite a few installable packages but we only want to install 3 of them and in the following order.

[cc lang=”php”]dpkg -i pure-ftpd-common_1.0.21-11.4ubuntu1_all.deb[/cc]

[cc lang=”php”]dpkg -i pure-ftpd_1.0.21-11.4ubuntu1_i386.deb[/cc]

[cc lang=”php”]dpkg -i pure-ftpd-mysql_1.0.21-11.4ubuntu1_i386.deb[/cc]

Now take the mysql.conf file we saved earlier and put it back into /etc/pure-ftpd/db.  I renamed the file in the directory to mysql.conf.orig then moved the other file in.  This is normally good practice incase something goes wrong you still have your original file.

Now restart PureFTP

[cc lang=”php”]/etc/init.d/pure-ftpd-mysql restart[/cc]

As long as you have not received any errors, you should have setup PureFTP correctly.

To Prevent the Packages from Updating

[cc lang=”php”]echo “pure-ftpd hold” | dpkg –set-selections[/cc]

[cc lang=”php”]echo “pure-ftpd-common hold” | dpkg –set-selections[/cc]

[cc lang=”php”]echo “pure-ftpd-mysql hold” | dpkg –set-selections[/cc]

Remove the hold (Incase you ever decide to update)

Replace “package” with the 3 pure-ftpd packages.

[cc lang=”php”]sudo echo “package install” | dpkg --set-selections[/cc]

Knowing the status of your packages

[cc lang=”php”]sudo dpkg –get-selections[/cc]

Enable TLS over FTP aka. FTPS

[cc lang=”apt_sources”]echo 1 > /etc/pure-ftpd/conf/TLS[/cc]

[cc lang=”php”]mkdir -p /etc/ssl/private/ [/cc]

[cc lang=”php”]openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem[/cc]

[cc lang=”php”]chmod 600 /etc/ssl/private/pure-ftpd.pem[/cc]

Restart pure-ftpd

[cc lang=”php”]/etc/init.d/pure-ftpd-mysql restart [/cc]

Leave a Reply

Your email address will not be published. Required fields are marked *