[HOW-TO] Set up your VPS/Dedicated Linux server for SA-MP with FTP!
#1

UPDATE
How to use iptables with centos (ban dos attacks etc) http://wiki.centos.org/HowTos/Network/IPTables
This should work with both 32 and 64bit
If you dont want to use ProFTPD for your ftp server, you can also use the alternative of vsftpd. Here is a guide to be followed (http://www.cyberciti.biz/faq/rhel-ce...ll-ftp-server/).
If your going to use VSFTPD then use the guide for step 3


I know that theres something like this on the wiki, but im going into alittle more depth for people who want to have a full solution.

This is for Centos 5, but you could do it on other distros of linux in a similar fashion.

1) Connecting to your server
2) Installing Webmin - Overall control panel for your server
3) Installing ProFTPD & Setting up FTP Accounts - FTP Access to your files
4) Setting up your SAMP Server directory & Running your SAMP Server

First of all you need a vps or a dedicated server. Once you've got that, follow these steps to get your samp server up and running.

1. Connecting to your server.
You can use a variety of different SSH Clients to connect to your server, i personally prefer Putty the most.
Download
Okay after you've got putty set up, open it up.

Put in your MAIN ip address to your server, and hit open at the bottom.
Make sure that the port connection is 22 unless your hoster specified otherwise.

Login with your information specified by your hoster.
Login as will almost always be root
Your password will be what you defined when you bought the server. You should now have a commandline similar to mine. Congrats, you connected to your server.

2.Installing Webmin
Okay, dont forget that im doing this on Centos, i cant highlight how to do this on every different linux system because it'll just take too long, but the ideas are the same. I highly recommend using linux, so if you haven't already you should switch over :]
Use these commands to install webmin
this will download webmin to your server. now use this command to install it
Code:
rpm -ivh webmin-1.490.noarch.rpm
After its installed you should be able to access webmin by going to
http://yourserversipaddress:10000

3. Installing ProFTPd on Centos 5
first we need all compilers neccessary
Code:
yum install gcc
Code:
yum install gcc-c++
Code:
yum install make
Set up the group that proftpd will run under
Code:
groupadd proftpd
Code:
useradd -d /srv/ftp -g proftpd -s /usr/bin/ftpshell proftpd
Code:
install -v -d -m775 -o proftpd -g proftpd /srv/ftp
Code:
ln -v -s /bin/false /usr/bin/ftpshell
Code:
echo /usr/bin/ftpshell >> /etc/shells
Okay, now lets install proftpd. First we need to download the source files
Code:
cd /usr/src_proftpd
Code:
tar xjf proftpd-1.3.2.tar.bz2
Code:
rm -f proftpd-1.3.2.tar.bz2
Now that we've got them extracted, lets install it
Code:
cd /usr/src_proftpd/proftpd-1.3.2
Code:
./configure --prefix=/usr --sysconfdir=/etc --localstatedir =/var/run
Code:
make
Code:
make install
Now we have to edit the configuration file , its located in /etc/proftpd.conf
You can use
Code:
vi /etc/proftpd.conf
but here im going to show you how to do it in webmin.
First log onto webmin. Then goto others->filemanager
Navigate to etc
Find the file called proftpd.conf
[img width=1024 height=489]http://destinyx.net/webmin.jpg[/img]
Hit the edit button when you've found it and modify the file to this.

Code:
#This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

ServerName           "Put in your server name here!"
ServerType           standalone
DefaultServer          on

# Port 21 is the standard FTP port.
Port              21

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask              022

# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances          30

# Set the user and group under which the server will run.
User              proftpd
Group              proftpd

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~

# Normally, we want files to be overwriteable.
AllowOverwrite     on

# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
 DenyAll
</Limit>
Now lets clean up all those source files we downloaded
Code:
cd /usr/src_proftpd
Code:
rm -Rf proftpd-1.3.2
And start up the ftp server!
Code:
proftpd
Okay, almost done. Now we need to make a FTP account for your server
Code:
useradd -d/home/yourusername -m yourusername
Code:
passwd yourusername
you can rename samp to whatever you want your folder and login name to be called, but it has to not exist yet or else it will fail
change your password to whatever you want it to be

Code:
Now you can login using a ftp client like FileZilla via this
Host : Your servers ip address
Port : 21
Username : yourusername
Password : yourpassword
Your username and your password being the ones you defined above under useradd and passwd

4. Almost done. all we have to do now is upload the samp files and run them. From now on im going to be reffering to my home samp directory as
Code:
/home/samp
my username as samp and my password as samp
but it will be different for everyone depending on what you defined it as.

Log into ssh
Code:
cd /home/samp
Code:
tar xvfz samp02Xsvr.tar.gz
Now log into your ftp, click on the samp02X folder, upload all your files, edit the cfg. Now get back into SSH and lets turn on your samp server.
Code:
cd /home/samp/samp02X/
Code:
nohup ./samp02X
Want to turn off your server (kill it) ? Use this method

Log into SSH
Code:
ps -ef
this command will generate a list of all processes on your server. Look for the ./samp02Xsvr under CMD
This was the one i had
Code:
root   13516   1 0 21:07 ?    00:00:00 ./samp02Xsvr
To kill the samp server, all you need to do now is get the processid, in this case it was 13516 and type
Code:
kill -9 13516
There, now your server is turned off!
If your going to be running more then one server i would recommend assigning different ssh groups for each server that you run so that its easier to differentiate.

And heres some other commands you can use on your linux server.

Finding your processor model & name
Code:
cat /proc/cpuinfo | grep -i 'Model'
Example Usage :
Code:
[root@linx2 ~]# cat /proc/cpuinfo | grep -i 'Model'
model      : 23
model name   : Intel® Core™2 Quad CPU  Q9400 @ 2.66GHz
View how much free ram you have in MB
Code:
free -m
If you want to view it in GB use this command
Code:
free -g
Example Usage :
Code:
[root@linx4 ~]# free -m
       total    used    free   shared  buffers   cached
Mem:      1768    1113    1654     0     0     0
-/+ buffers/cache:    1113    1654
Swap:      0     0     0
General System Information command
Code:
top
I hope that helped someone, i could of really used one of these when i first started out with samp and linux :P

Note : This was geared at if your running only one server on your box. If your planning on running more then one server you should use seperate user accounts for each server that is being run


Reply
#2

LMAO

You dont need Webmin for FTP for Linux

I currently have a Linux VPS and I dont need webmin

Webmin = Waste of Memory
Reply
#3

hes putting webmin on it for ease of use u tool, And no offense i know linx and he could absolutely mop the floor with u with this knowledge on linux
Reply
#4

Quote:
Originally Posted by [mad
MLK (dino-host.net) ]
hes putting webmin on it for ease of use u tool, And no offense i know linx and he could absolutely mop the floor with u with this knowledge on linux
Couldnt have said it better myself!! Btw, great tutorial linx!!!!
Reply
#5

good tutorial, but maybe you can say what to write in proftpd.conf that logged in FTP user can chmod, store, delete, create etc. ? Because now, for example with chmod i get that 550 CHMOD 777 filename.php: Operation not permitted
Pls help
Reply
#6

Quote:
Originally Posted by Dreftas
good tutorial, but maybe you can say what to write in proftpd.conf that logged in FTP user can chmod, store, delete, create etc. ? Because now, for example with chmod i get that 550 CHMOD 777 filename.php: Operation not permitted
Pls help
the .conf sets it up so that if you go a higher level then your current directory you cant modify anything (chroot)
sorry idk if i understood that correctly.

like for example if you created a user directory called mydirct, you cant add any files above that directory, only below it. if you want to disable this try changing this
Code:
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~
to this
Code:
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
# DefaultRoot ~
also @jbosh, webmin only uses 8-22 mb of ram on my machine. If thats seriously considered alot for you , you should consider getting off the 64mb ram vps
Reply
#7

Quote:
Originally Posted by #Linx
Quote:
Originally Posted by Dreftas
good tutorial, but maybe you can say what to write in proftpd.conf that logged in FTP user can chmod, store, delete, create etc. ? Because now, for example with chmod i get that 550 CHMOD 777 filename.php: Operation not permitted
Pls help
the .conf sets it up so that if you go a higher level then your current directory you cant modify anything (chroot)
sorry idk if i understood that correctly.

like for example if you created a user directory called mydirct, you cant add any files above that directory, only below it. if you want to disable this try changing this
Code:
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~
to this
Code:
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
# DefaultRoot ~
No, no..
I made:
Quote:

useradd -d/opt/lampp/htdocs/forum -m user

When user log in into FTP he appears at directory /opt/lampp/htdocs/forum ,thats OK.
But he cant do anything in that directory except browsing, i need upload/download/chmod, how to do that?
Reply
#8

nice tutorial
Reply
#9

Quote:
Originally Posted by Dreftas
Quote:
Originally Posted by #Linx
Quote:
Originally Posted by Dreftas
good tutorial, but maybe you can say what to write in proftpd.conf that logged in FTP user can chmod, store, delete, create etc. ? Because now, for example with chmod i get that 550 CHMOD 777 filename.php: Operation not permitted
Pls help
the .conf sets it up so that if you go a higher level then your current directory you cant modify anything (chroot)
sorry idk if i understood that correctly.

like for example if you created a user directory called mydirct, you cant add any files above that directory, only below it. if you want to disable this try changing this
Code:
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~
to this
Code:
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
# DefaultRoot ~
No, no..
I made:
Quote:

useradd -d/opt/lampp/htdocs/forum -m user

When user log in into FTP he appears at directory /opt/lampp/htdocs/forum ,thats OK.
But he cant do anything in that directory except browsing, i need upload/download/chmod, how to do that?
um try this

in your proftpd conf file replace
Code:
# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
 DenyAll
</Limit>
with
Code:
# Bar use of SITE CHMOD by default
#<Limit SITE_CHMOD>
# DenyAll
#</Limit>
then restart your proftpd server
Code:
killall proftpd
Code:
proftpd
and ty brett ^^
Reply
#10

Quote:
Originally Posted by Linx [Stunt Revolution
]
um try this

in your proftpd conf file replace
Code:
# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
 DenyAll
</Limit>
with
Code:
# Bar use of SITE CHMOD by default
#<Limit SITE_CHMOD>
# DenyAll
#</Limit>
then restart your proftpd server
Code:
killall proftpd
Code:
proftpd
and ty brett ^^
Code:
SITE CHMOD 777 viewtopic.php
550 CHMOD 777 viewtopic.php: Operation not permitted
If you need - this is my proftp.conf:
Code:
#This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

ServerName           "Time2Play!"
ServerType           standalone
DefaultServer          on

# Port 21 is the standard FTP port.
Port              21

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask              022

MaxClients 10
MaxClientsPerHost 10
MaxClientsPerUser 10
MaxHostsPerUser 10

# Display a message after a successful login
AccessGrantMsg "TimeToPlay FTP"


# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances          30

# Set the user and group under which the server will run.
User              root
Group              root

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~

# Normally, we want files to be overwriteable.
AllowOverwrite     on

# Bar use of SITE CHMOD by default
#<Limit SITE_CHMOD>
# DenyAll
#</Limit>
Please help someone, I really need this :/

P.S. CentOS release 5.3 (Final)
Reply
#11

No one know?
Reply
#12

To be honest, i think this should be in server support. not Scripting Chat.
Reply
#13

Quote:
Originally Posted by Linx [Stunt Revolution
]
Shit i just realized i posted this in scripting discussion. If a mod could move it to server support that would be great thanks :]
Learn to read.
Reply
#14

First: i dont read the post because im not interested in the topic, just wanted to post an opinion.

Second: Yes i know i should have read, however keep in mind how you ask people to kindly read, and what you say to others, because you are advertising a hosting company, and if you do present an attitude, it may turn customers away. Now, im not saying you came back with a hate speech but just for future reference.
Reply
#15

I've got three functions for you.

yum (CentOS, YDL)
apt and aptitude (Debian, Ubuntu, etc)
Reply
#16

I fixed it all! I typed it wrong.

Nice tutorial, this is really helping.
Reply
#17

For me; This should be stickied.
Reply
#18

Quote:
Originally Posted by [DP
eXchainZ ]
For me; This should be stickied.
Not really. It's over-complicated yet doesn't go into detail on anything. What if it's a 64bit OS? What about configuring the firewall?
Reply
#19

I'm sure he coould add more, I think it's be even better if he added more to it anyway.
Reply
#20

Quote:
Originally Posted by RoBo
Quote:
Originally Posted by [DP
eXchainZ ]
For me; This should be stickied.
Not really. It's over-complicated yet doesn't go into detail on anything. What if it's a 64bit OS? What about configuring the firewall?
IPTables : http://wiki.centos.org/HowTos/Network/IPTables

It will work with 64bit
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)