Category Archives: Server Tutorial

How to Install rTorrent/ruTorrent on Debian/Ubuntu VPS

This tutorial will guide you through the setup of a fully-featured seedbox running on a Debian or Ubuntu system, including:
libtorrent 0.13.0
rTorrent 0.9
ruTorrent Web UI (3.0)
This guide has been tested with Debian 6 (x86_64) and Ubuntu 11.04 (x86_64).

To start, access your VPS via SSH (as the root user) and do the following to update your platform and install some required dependencies:
# apt-get update
# apt-get install subversion build-essential automake libtool libcppunit-dev libcurl3-dev libsigc++-2.0-dev unzip unrar-free curl libncurses-dev
# apt-get install apache2 php5 php5-cli php5-curl
Enable scgi for Apache:
# apt-get install libapache2-mod-scgi
# ln -s /etc/apache2/mods-available/scgi.load /etc/apache2/mods-enabled/scgi.load
Install XMLRPC:
# mkdir /install;cd /install
# svn checkout http://xmlrpc-c.svn.sourceforge.net/…mlrpc-c/stable xmlrpc-c
# cd xmlrpc-c
# ./configure –disable-cplusplus
# make
# make install

How to install filezilla on centos 5.X

The default RPMforge repository does not replace any CentOS base packages. In the past it used to, but those packages are now in a separate repository (rpmforge-extras) which is disabled by default.

You can find a complete listing of the RPMforge package packages at http://packages.sw.be/

Download the rpmforge-release package. Choose one of the two links below, selecting to match your host’s architecture. If you are unsure of which one to use you can check your architecture with the command uname -i

The preferred rpmforge-release package to retrieve and to install in order to enable that repository is one of the two listed above.

Install DAG’s GPG key

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

Verify the package you have downloaded

rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm

:The rpmforge-release package imports GPG keys into your RPM database. As long as you have verified the md5sumof the key injection package, and trust Dag, et al., then it should be as safe as your trust of them extends.

Install the package

rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm

This will add a yum repository config file and import the appropriate GPG keys.

install filezilla

yum install filezilla

Replacing MySQL with MariaDB in a CentOS VPS

Hello,

MariaDB is a database server that offers drop-in replacement functionality for MySQL. MariaDB is built by some of the original authors of MySQL, with assistance from the broader community of Free and open source software developers. In addition to the core functionality of MySQL, MariaDB offers a rich set of feature enhancements including alternate storage engines, server optimizations, and patches.

Before installation you can wget its packages from a mirror:
1. Go to their download page: http://downloads.askmonty.org/mariadb/
2. Select the version you wish to use (personally I like the new 5.3 series given the improvements it has)
3. Select the linux package in the checkbox and it should give you some options
4. In my case, since my CentOS install is i386 I’ve clicked in “CentOS 5 x86 RPMs”
5. Browse the mirror rpms and wget each of them in the server. I recommend creating a new directory for the packages to be downloaded into.

mkdir mariadb
cd mariadb
wget package-url

Now you can follow the instructions here:
kb.askmonty.org/en/installing-mariadb-rpm-files
kb.askmonty.org/en/how-can-i-upgrade-from-mysql-to-mariadb

Possible issues and fixes:
I had it complaining about missing Perl(DBI) running “yum install perl-DBI” (without quotes) in ssh installs that dependency.
Since you had to remove mysql from your server, you may have also removed php-mysql package. To reinstall it “yum install php-mysql” (without quotes) and then restart apache.

Tuning MariaDB:
Create or edit the my.cnf file at /var/lib/mysql/

Add add this:

[mysqld]
default-storage-engine=myisam
ignore-builtin-innodb

Setting default storage engine back to myisam is useful if you, for some reason, want to go back to MySQL.
Disabling innodb would reduce RAM usage if you don’t need it.

Issues with Webmin and how to fix:
MySQL Database Server > Module Config

Command to start MySQL server: /etc/init.d/mysql start
Command to stop MySQL server: /etc/init.d/mysql stop
MySQL configuration file: /var/lib/mysql/my.cnf

Should you require any help, reply to this thread and I (or someone) will help you 

PS: Don’t forget to restart mysql after changing configuration

 

credit goes to neweracracker

What is Core Files in Linux? And how to disable Core file create into cpanel ?

A core file created when ever a program terminates unexpectedly and its also useful for determining what caused the termination. In many Linux server by default they do not produce core files when programs crash or terminates unexpectedly.

On  most of the Linux server core file size limitation is set to 0.You can check the core file size limit set in server by using following command.

root@srv [~]# ulimit -c
1000000

In above command core file size limit is 1000000 if output occur empty then it means core file size limit haven’t set on server and you can set it as

root@srv [~]# ulimit -c 1000000

or

root@srv [~]# ulimit -c unlimited

If you want to test core file limit is working on your server or not? then run following command

kill -s SIGSEGV $$

This above command will crashes your shell and produces core file in the current directory. as core.*

If core file is taking lots of disk space on server and you want to disable it then follow the steps one by one.

root@srv [~]#which httpd

/usr/sbin/httpd

root@srv [~]#pico /usr/sbin/httpd

And following line in /usr/sbin/httpd

ulimit -c 0

And then restart the Apache server

And then run

root@srv [~]#  ulimit -c 0

this command into ssh .

You can verify it by

root@srv [~]# ulimit -c

0

 

How to install red5 properly with TROUBLESHOOTING

Red5 Installation In centos 5.6 32/64bit

INSTALL JAVA

yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

INSTALL ANT

cd /usr/src
wget http://apache.mirrors.pair.com/ant/binaries/apache-ant-1.9.0-bin.tar.bz2
tar jxvf apache-ant-1.9.0-bin.tar.bz2
mv apache-ant-1.9.0 /usr/local/ant

 

EXPORT VARIABLES FOR ANT AND JAVA

export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/lib/jvm/java
export PATH=$PATH:/usr/local/ant/bin
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip

echo 'export ANT_HOME=/usr/local/ant' >> /etc/bashrc
echo 'export JAVA_HOME=/usr/lib/jvm/java' >> /etc/bashrc
echo 'export PATH=$PATH:/usr/local/ant/bin' >> /etc/bashrc
echo 'export CLASSPATH=.:$JAVA_HOME/lib/classes.zip' >> /etc/bashrc

INSTALL SVN

/usr/bin/yum install subversion

yum install perl-URI [if needed. unless avoid this option]

Quote:

Common problem when you will try to install this

root@server [/usr/local/src]# yum install subversion
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.nluug.nl
 * extras: ftp.nluug.nl
 * updates: ftp.nluug.nl
Excluding Packages in global exclude list
Finished
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package subversion.i386 0:1.6.11-7.el5_6.3 set to be updated
--> Processing Dependency: perl(URI) >= 1.17 for package: subversion
--> Processing Dependency: neon >= 0.25.5-6.el5 for package: subversion
--> Processing Dependency: libneon.so.25 for package: subversion
--> Processing Dependency: libapr-1.so.0 for package: subversion
--> Processing Dependency: libaprutil-1.so.0 for package: subversion
---> Package subversion.x86_64 0:1.6.11-7.el5_6.3 set to be updated
--> Processing Dependency: perl(URI) >= 1.17 for package: subversion
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: subversion
--> Processing Dependency: libapr-1.so.0()(64bit) for package: subversion
--> Running transaction check
---> Package apr.i386 0:1.2.7-11.el5_5.3 set to be updated
---> Package apr.x86_64 0:1.2.7-11.el5_5.3 set to be updated
---> Package apr-util.i386 0:1.2.7-11.el5_5.2 set to be updated
--> Processing Dependency: libpq.so.4 for package: apr-util
---> Package apr-util.x86_64 0:1.2.7-11.el5_5.2 set to be updated
--> Processing Dependency: libpq.so.4()(64bit) for package: apr-util
---> Package neon.i386 0:0.25.5-10.el5_4.1 set to be updated
---> Package neon.x86_64 0:0.25.5-10.el5_4.1 set to be updated
---> Package subversion.i386 0:1.6.11-7.el5_6.3 set to be updated
--> Processing Dependency: perl(URI) >= 1.17 for package: subversion
---> Package subversion.x86_64 0:1.6.11-7.el5_6.3 set to be updated
--> Processing Dependency: perl(URI) >= 1.17 for package: subversion
--> Running transaction check
---> Package postgresql-libs.i386 0:8.1.23-1.el5_6.1 set to be updated
---> Package postgresql-libs.x86_64 0:8.1.23-1.el5_6.1 set to be updated
---> Package subversion.i386 0:1.6.11-7.el5_6.3 set to be updated
--> Processing Dependency: perl(URI) >= 1.17 for package: subversion
---> Package subversion.x86_64 0:1.6.11-7.el5_6.3 set to be updated
--> Processing Dependency: perl(URI) >= 1.17 for package: subversion
--> Finished Dependency Resolution
subversion-1.6.11-7.el5_6.3.x86_64 from updates has depsolving problems
  --> Missing Dependency: perl(URI) >= 1.17 is needed by package subversion-1.6.11-7.el5_6.3.x86_64 (updates)
subversion-1.6.11-7.el5_6.3.i386 from updates has depsolving problems
  --> Missing Dependency: perl(URI) >= 1.17 is needed by package subversion-1.6.11-7.el5_6.3.i386 (updates)
Error: Missing Dependency: perl(URI) >= 1.17 is needed by package subversion-1.6.11-7.el5_6.3.i386 (updates)
Error: Missing Dependency: perl(URI) >= 1.17 is needed by package subversion-1.6.11-7.el5_6.3.x86_64 (updates)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package

then you could temporarily remove perl from the /etc/yum.conf exclude line, install subversion, then add perl back to the /etc/yum.conf exclude line after you’ve gotten subversion installed.

INSTALL RED5

cd /usr/src

svn co http://red5.googlecode.com/svn/java/server/tags/0_8_0/ red5     
Version 0.8.0 or
svn co http://red5.googlecode.com/svn/java/server/tags/0_9_1/ red5
Version 0.9.1 or
svn co http://red5.googlecode.com/svn/java/server/tags/1_0/ red5
Version 1.0
mv red5 /usr/local/ cd /usr/local/red5 ant prepare ant dist cp -r dist/conf .

START RED5

./red5.sh

in that time your installation can get hanged wait 30-40min after that press ctrl+c

then
CREATE INIT FILE

cd /etc/init.d/
wget http://blog.host4offshore.com/red5.txt
mv red5.txt red5
chmod +x red5
service red5 start

then visit your RED5 ADMIN

http://YOUR_SERVER_IP:5080/installer/ (and install admin)
http://YOUR_SERVER_IP:5080/admin/register.html (add user/pass)

Common problem
if you face

HTTP Status 404 - /admin/register.html

type Status report

message /admin/register.html

description The requested resource (/admin/register.html) is not available.

Apache Tomcat/6.0.26

if you faced this types of problem then follow this steps

Get the plugins:

cd /root/tmp
mkdir /usr/local/red5/plugins
wget http://red5.googlecode.com/files/AdminPlugin-1.0.zip
unzip -d /usr/local/red5/plugins AdminPlugin-1.0.zip
Get the Red5 admin register page:

mkdir /usr/local/red5/webapps/admin
wget http://red5.googlecode.com/files/admin.jsp
mv admin.jsp /usr/local/red5/webapps/admin

then again restart Red5 (/etc/init.d/red5 restart)/(service red5 restart)

this all step working tested by me in centos 64bit os (cpanel)

MySQL: Repair & Optimize all Tables in all Databases

MySQL tables can crash quite easily, especially when your server unexpectedly shuts down or crashed, or when you’re forced to copy data around when it’s still being accessed.

Luckily, there’s a simple command to automatically check, repair and optimize all tables in all databases when you’re running a MySQL server on Linux / Unix / BSD.

mysqlcheck -u root -p --auto-repair --check --optimize --all-databases

That’s all there is to it!

mysqlcheck is available since MySQL 3.23.38; if you haven’t slept under a rock so long you might step onto your own beard, you can probably use it on your server.

Simple Bash Script to Fix Account Permissions

This is a simple bash script I wrote to fix the permissions and ownership of files within a cpanel account. To use, simply copy the script your server, chmod 755, and pass the usernames as arguments:

./fixperms user1 user2 user3

You can also run a server-wide loop like this:

for i in `ls -A /var/cpanel/users` ; do ./fixperms $i ; done

Secure Your SSH Access

To restrict and secure SSH access, bind sshd to a single IP that is different than the main IP to the server, and on a different port than port 22.

SSH into server and login as root.

At command prompt type: pico /etc/ssh/sshd_config

Scroll down to the section of the file that looks like this:

#Port 22
#Protocol 2, 1
#ListenAddress 0.0.0.0
#ListenAddress ::

Uncomment and change

How to Secure and Optimize a Server or VPS – 2

Tutorials following continued discussions from How to Secure and Optimize a Server or VPS part 1

=========================================
Install BFD (Brute Force Detection – optional)
=========================================

To install BFD, SSH into server and login as root.

At command prompt type:

cd /root/
wget http://www.rfxnetworks.com/downloads/bfd-current.tar.gz
tar -xvzf bfd-current.tar.gz
cd bfd-0.4
./install.sh

How to Secure and Optimize a Server or VPS – 1

When you have a Dedicated Server or Virtual Private Server (VPS) security issues and optimization of a server is a necessity that must be considered by a sysadmin. Here I have to say a few ways that can be used to secure and optimize a Dedicate server or Virtual Private Server (VPS).

=========================================
Checking for formmail
=========================================

Form mail is used by hackers to send out spam email, by relay and injection methods.

Command to find pesky form mails:

find / -name "[Ff]orm[mM]ai*"

CGIemail is also a security risk:

find / -name "[Cc]giemai*"

Command to disable form mails:

chmod a-rwx /path/to/filename

(a-rwx translates to all types, no read, write or execute permissions).

(this disables all form mail)

If a client or someone on your vps installs form mail, you will have to let them know you are disabling their script and give them an alternative.