• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Debian Server Setup [Deleted]

Adam Howard

Well-known member
#1
Adam Howard submitted a new resource:

Debian Server Setup (version 6.0) - Basic guide on how to setup and install your own VPS or Dedicated Server without a control panel

I felt this was needed for all the many people here who may wish to develop their XenForo site without the need for a control panel such as cPanel (just dos prompt / command prompt). Typically those of you seeking to use a VPS, Semi-Dedicated, or Dedicated Server for the first time or who are generally new to Linux.

While it is true there are a lot of other guides online, many of them are outdated or insecure.

This guide will cover the most easiest and basic setup for any beginning using...
Read more about this resource...
 

Adam Howard

Well-known member
#2
NOTE:

This guide was tested on Debian 6 and Debian 7

It can be used for Ubuntu by simply using Ubuntu's repositories and NOT Debain's repositories.

It can be used for Mint Linux by simply using Mint's repositories and NOT Debain's repositories.

IMPORTANT: It is strongly advised you do not mix repositories (use the repositories for the correct version of Linux you are using)
 

Chris D

XenForo developer
Staff member
#3
I'm going to try this out in Ubuntu.

Been meaning to do this.

Traditionally I'm a Windows man (day job) so beginning to dabble in Linux is long overdue!
 

Adam Howard

Well-known member
#4
I'm going to try this out in Ubuntu.

Been meaning to do this.

Traditionally I'm a Windows man (day job) so beginning to dabble in Linux is long overdue!
Been using Ubuntu on my home computer for a little over 1 year now. I have an older and smaller (80GB) for Windows, which I only use for the few games which will not play well with Wine. I've not been disappointed.

If you're going to follow this guide for Ubuntu... Remember to use their repositories and not the ones supplied. Everything else in this guide will work as expected (and you can follow it).
 

Adam Howard

Well-known member
#5
Question: How do you setup FTP?

Answer: The less you have installed, the less resources you will be using. And the less ways into your server, the more secure you are.

I much prefer using SFTP which is automatically configured through SSH (already pre-installed and configured with any copy of Linux).

There is a debate on the value on doing this. Some will argue this is less secure and unwise and others like myself will point out that FTP protocols are often proven insecure either directly or indirectly.

However, one thing I forgot to add into this guide and will include now.... Is you DO want to change your ssh / sftp port away from the default

PHP:
nano /etc/ssh/sshd_config
Within the first 5 lines, you should clearly see something that reads

PHP:
Port 22
Change this number to whatever port you like except for (do not use) port 21, 80, 81, or any other common port.

PHP:
/etc/init.d/ssh restart
Depending what other services or processes you have; you may need to reboot for this to take affect (as it could remain in memory).
 

Adam Howard

Well-known member
#6
A little toy for advance users to help fight spam bots
You're welcome :)


Command: crontab -e

0 12 * * * /home/spam.sh >/dev/null 2>&1

PHP:
#!/bin/bash
 
IPT=”/sbin/iptables”
 
FILE=”/tmp/drop.lasso”
 
URL=”http://www.spamhaus.org/drop/drop.lasso”
 
echo “”
 
echo -n “Deleting DROP list from existing firewall…”
 
#This will delete all dropped ips from firewall
 
ipdel=$(cat $FILE  | egrep -v ‘^;’ | awk ‘{ print $1}’)
 
for ipblock in $ipdel
 
do
 
$IPT -D spamhaus-droplist -s $ipblock -j DROP
 
$IPT -D droplist -s $ipblock -j LOG –log-prefix “DROP Spamhaus List”
 
done
 
echo -n “Applying DROP list to existing firewall…”
 
#This will drop all ips from spamhaus list.
 
[ -f $FILE ] && /bin/rm -f $FILE || :
 
cd /tmp
 
wget $URL
 
blocks=$(cat $FILE  | egrep -v ‘^;’ | awk ‘{ print $1}’)
 
$IPT -N spamhaus-droplist
 
for ipblock in $blocks
 
do
 
$IPT -A droplist -s $ipblock -j LOG –log-prefix “DROP Spamhaus List”
 
$IPT -A droplist -s $ipblock -j DROP
 
done
 
$IPT -I INPUT -j droplist
 
$IPT -I OUTPUT -j droplist
 
$IPT -I FORWARD -j droplist
 
echo “…Done”
 

Adam Howard

Well-known member
#7
Question: I really want to do this, but I'm not completely comfortable doing this myself. Will you do this for me?

Answer: YES, I will be willing to setup a basic Debian, Ubuntu, or Mint web server for anyone. However there will be a small fee of $25 for me to do so.

If you wish me to also install your forum with add-ons (yes, I'll even install the add-ons and skins) it is another $25.
 

Adam Howard

Well-known member
#8
Question:

I wanted to do this on a local install on my home computer so that I may test and run things locally, but got the following message from the terminal.

PHP:
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
What am I doing wrong?

Answer:

Typically on your own computer you will need to start everything with the sudo command.

It is a security feature for Linux not to run everything using full root access. When doing this remotely, you're automatically log-in as root. But typical from the desktop, the computer doesn't want your average low end user doing crazy things without first giving it some thought.

See example
PHP:
sudo X Y Z
Simply add sudo before whatever you're doing (update, upgrade, or install)
 

Adam Howard

Well-known member
#11
Adam Howard updated Debian Server Setup with a new update entry:

small typing error

This small typing error should not have really affected many people. Aptitude is smart when I tried imputing this command, it was able to point it out to me and suggest the correct typing.

But for those of who you used apt-get and not aptitude as you you advised to do so. The following...

PHP:
libapache2-mod-php5-mysql
Should have read

PHP:
libapache2-mod-php5 php5-mysql
To make sure everything is installed correctly and if you didn't notice this and correct it...
Read the rest of this update entry...
 

Adam Howard

Well-known member
#12
Dedicated Server

Linux Kernel 3.6 Stable has been released. :D

The improvements include better hardware support, security bug fixes, and better memory optimizations.

Caution

VPS Servers are a toss up.

Some you can update the kernel and some you can not, because they're plugged into a "master shell" which connects them all for easier super administrator managements ... ie... Your host, who in the end is basically "GOD" over the server.

This varies though so some VPS servers can update the kernel and some can not. I'd suggest you contact your host about this first.

For the rest of you who have true dedicated servers. A kernel upgrade can be very useful.

BACK UP EVERY-THING

Place this script in your /tmp folder

PHP:
cd /tmp
PHP:
chmod +x linux-kernel-3.6
PHP:
sh linux-kernel-3.6
This will install Linux Kernel 3.6 for you.

IMPORTANT = Once completed (successful install) you MUST reboot. If you can not reboot for whatever reason... Do not proceed with trying to install this.

PHP:
reboot
Remember it could take a few minutes before you are back online. Do not panic if things do not boot up right away.

Thanks and credit to Ubuntu who actually host generic vanilla kernels and thus make this possible for anyone using Debian, Ubuntu, or even Linux Mint :)

Tested on Debian 6, 7, Ubuntu 12.04, 12.10, and Mint (current).


The full script code is thus:

PHP:
#!/bin/bash
 
#### Script Created By SociallyUncensored.eu ####
 
#i386 links
 
link1="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.6-quantal/linux-headers-3.6.0-030600_3.6.0-030600.201209302035_all.deb"
 
link2="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.6-quantal/linux-headers-3.6.0-030600-generic_3.6.0-030600.201209302035_i386.deb"
 
link3="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.6-quantal/linux-image-3.6.0-030600-generic_3.6.0-030600.201209302035_i386.deb"
 
link4="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.6-quantal/linux-image-extra-3.6.0-030600-generic_3.6.0-030600.201209302035_i386.deb"
 
#amd64 links
 
url1="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.6-quantal/linux-headers-3.6.0-030600-generic_3.6.0-030600.201209302035_amd64.deb"
 
url2="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.6-quantal/linux-image-3.6.0-030600-generic_3.6.0-030600.201209302035_amd64.deb"
 
url3="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.6-quantal/linux-image-extra-3.6.0-030600-generic_3.6.0-030600.201209302035_amd64.deb"
 
#System architecture
 
arch=`uname -m`
if  [ $arch = i686 ] || [ $arch = i386 ]; then
 
mkdir $HOME/kernel3.6-i386
 
sudo rm -rf $HOME/kernel3.6-i386/*
 
cd $HOME/kernel3.6-i386
 
wget $link1
wget $link2
wget $link3
wget $link4
 
sudo dpkg -i *.deb
 
sudo rm -rf $HOME/kernel3.6-i386
 
elif [ $arch = "x86_64" ]; then
 
 
mkdir $HOME/kernel3.6-amd64
 
sudo rm -rf $HOME/kernel3.6-amd64/*
 
cd $HOME/kernel3.6-amd64
 
wget $link1
wget $url1
wget $url2
wget $url3
 
sudo dpkg -i *.deb
 
sudo rm -rf $HOME/kernel3.6-amd64
 
    else
        echo "Unsupported Architecture"
fi
 

Attachments

Adam Howard

Well-known member
#13
Adam Howard updated Debian Server Setup with a new update entry:

Optional Linux Kernel Update

Linux Kernel 3.6 Stable has been released :D

This update is optional. It does improve hardware support, security fixes, and better memory optimization.

But it also comes with its own risk. Those risk could lead to a brick (dead) server.

Back up EVERY-THING if you decide to try this AND upon successful install, you MUST reboot. If you can not do so, do not try this....
Read the rest of this update entry...
 

Sway

Active member
#17
I can't seem to get phpmyadmin installed on my new server. I run nginx. There are only 2 options for this. Apache and lighthttp or whatever it's called lol..
 

Adam Howard

Well-known member
#18
I can't seem to get phpmyadmin installed on my new server. I run nginx. There are only 2 options for this. Apache and lighthttp or whatever it's called lol..
It's been a while since I played with nginx. While it is faster... I find it next to impossible to teach. Just about everything changes in each version.

I could tell you that v1.0 to do X. But in v1.1 it would be different. And it would change completely again in v1.2 :confused:

Until they settle on a few things..... I'd stick to Apache.
 

Sway

Active member
#19
It's been a while since I played with nginx. While it is faster... I find it next to impossible to teach. Just about everything changes in each version.

I could tell you that v1.0 to do X. But in v1.1 it would be different. And it would change completely again in v1.2 :confused:

Until they settle on a few things..... I'd stick to Apache.
Nginx is great once you finally figure it out.
I think i managed to get phpmyadmin working again. I used a symlink.

Also, when installing phpmyadmin with aptitude it seems to prompt you for an automatic configuration for one of those 2 web servers. I managed to install it with apt-get without getting that prompt.
 

Adam Howard

Well-known member
#20
Nginx is great once you finally figure it out.
I think i managed to get phpmyadmin working again. I used a symlink.
My problem wasn't learning..... My problem was being forced to re-learn and re-configure for every update, for every version. :confused:

Also, when installing phpmyadmin with aptitude it seems to prompt you for an automatic configuration for one of those 2 web servers. I managed to install it with apt-get without getting that prompt.
I cover that in the instructions ;)

You'll be asked if you want phpMyAdmin to make its own database, say NO
apt-get will sometime also bring up that option. Always select NO.