Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

> [HOWTO], FAQ, Guides

views
     
TSbiatch0
post Apr 20 2004, 11:42 PM, updated 13y ago

Tem Que Valer
Group Icon
VIP
1,856 posts

Joined: Jan 2003
From: NL/MY



This guide "should" be applicable to most other versions of Apache 1. No guide for Apache 2 unfortunately, as I'm not a very big fan. In this example, we'll be using Apache 1.3.29, PHP 4.3.6, MySQL. If new versions come out, you can improvise, read the README, Google, or whatever... but this guide is unlikely to be updated ever again. The more initiated of you may realise that a lot of the instructions come from the README/INSTALL files, but then again, nobody ever reads things that are named README. Maybe they should start renaming the README file to "HOT SEXY STORY".

First up, you'll need to grab all the relevant source distributions. THIS GUIDE DOES NOT DEAL WITH RPMs OF ANY SORT. Make sure you dump them somewhere you remember for convenience sake (I generally use /root/tmp and I will assume you do the same, otherwise, replace /root/tmp with your own dir). You can download the various source tar.gz files from the links below:
Apache - At time of writing: Apache 1.3.29
PHP - At time of writing: PHP 4.3.6
MySQL - At time of writing: MySQL 4.0.18

I generally start of installing MySQL since it doesn't require any referencing. Here's how to go about compiling and installing your source distribution of MySQL. NOTE: If things don't seem to work, YOU DON'T HAVE THE SOURCE DISTRIBUTION. GO AND GET IT. You will need to change the mysql-VERSION.tar.gz to mysql-4.0.18.tar.gz or whatever matches your current version.

CODE
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db
shell> chown -R root  .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &


This should have compiled, installed and started the MySQL daemon for you. Nifty... If you keep getting "Permission Denied" or an equivalent error, you might want to know that you need to be logged in as root in order for most of this work. Now, MySQL is over and done with... let's move on to Apache/PHP.

Apache/PHP is slightly more complicated. You'll need to change directories (HORRORS!!!). Anyway, moving along; do the following. You will need to change the apache_1.3.x.tar.gz to apache_1.3.29.tar.gz or relevant version number; and do the same for PHP.

CODE
1.  gunzip apache_1.3.x.tar.gz
2.  tar xvf apache_1.3.x.tar
3.  gunzip php-x.x.x.tar.gz
4.  tar xvf php-x.x.x.tar
5.  cd apache_1.3.x
6.  ./configure --prefix=/usr/local/apache
7.  cd ../php-x.x.x
8.  ./configure --with-mysql --with-apache=../apache_1.3.x
9.  make
10. make install
11. cd ../apache_1.3.x
12. ./configure --activate-module=src/modules/php4/libphp4.a
13. make
14. make install
15. cd ../php-x.x.x
16. cp php.ini-dist /usr/local/lib/php.ini
17. Edit your httpd.conf or srm.conf file and add:
     AddType application/x-httpd-php .php


At this point, you may be interested in looking thru your httpd.conf and change whatever settings you fancy. I generally change the index order, and some other useless junk.

CODE
<IfModule mod_dir.c>
  DirectoryIndex index.html
</IfModule>

to
CODE
<IfModule mod_dir.c>
  DirectoryIndex index.php index.html index.htm
</IfModule>


Once you're done, figure out where your default htdocs directory is (by default it's /usr/local/apache/htdocs I think) and do the following:

CODE
1.  cd /usr/local/apache/htdocs
2.  pico index.php
3.  Insert the following:
     <? phpinfo(); ?>
4.  Save & exit
5.  apachectl start


At this point, you should have a working webserver which should work happily with your MySQL server. Fire up your browser and point it to http://localhost or whatever your site is. You should see a bunch of garbage that has to do with PHP settings... If so, you're done.

This post has been edited by kons: Jun 20 2007, 09:11 AM
kons
post Jun 20 2007, 09:16 AM

Конс
Group Icon
Moderator
5,819 posts

Joined: Oct 2004



Delete really lots of files

Sometimes rm command can't handle too many files.
Another neat way to do it is to try this:-

CODE
find . -name "*" -print | xargs rm


Replace * with the file names to match

It can be further tweaked to do recursive delete.


Added on June 25, 2007, 11:52 pmClear history of all typed command

CODE
history -c


This post has been edited by kons: Jun 25 2007, 11:52 PM
DeviousEgg
post Nov 26 2007, 09:06 PM

Getting Started
**
Junior Member
61 posts

Joined: Oct 2007
Nifty... was looking around for this and never thought of looking here... Thanks...
kons
post Jan 29 2008, 01:49 PM

Конс
Group Icon
Moderator
5,819 posts

Joined: Oct 2004



Linux clock runs too fast on VPC

http://support.microsoft.com/kb/918461

Set clock=pit to the kernel boot line in grub.conf


Added on February 18, 2008, 6:28 pmGenerate Artificial Load in Linux.

touch test; i=10; while ((i--)); do while [ -e test ]; do echo $RANDOM > /dev/null; done & done

i=x, where x is the load.
i=10 would generate load avg of 10
i=20 would generate load avg of 20

To stop, just rm -f test.


This post has been edited by kons: Oct 23 2008, 09:28 AM
kons
post Oct 23 2008, 09:28 AM

Конс
Group Icon
Moderator
5,819 posts

Joined: Oct 2004



Simulate DHCP request without changing the physical IP on the eth (Testing DHCP service only)

CODE
dhclient -1 -s 192.168.48.2 -cf /dev/null -pf /tmp/test.pid -sf /tmp/s eth1


-1 = do it one time
-s = dhcp server
-cf = config file
-pf = pid file
-sf = script file
eth1 = interface

If failed, returns exit code 2
kons
post Oct 24 2008, 04:35 PM

Конс
Group Icon
Moderator
5,819 posts

Joined: Oct 2004



Checking number of connection entries

One way to limit p2p is to install ip_conntrack modules and iptables connlimit modules.
connlimit module can block the number of connections that the end-user can get at one time, if you set it to 100, that means the end-users can only connect to 100 host at a time, which is fine for web surfing but for p2p, it is too restrictive.
connlimit will limit those ip_conntrack entries in ESTABLISHED state only.

To check the number of connections that an end-user has:

CODE
cat /proc/net/ip_conntrack|grep ESTABLISHED|cut -d '=' -f2|sort|uniq -c|sort -nr|head -n 20




MOBAJOBG
post Sep 18 2011, 12:02 PM

Getting Started
**
Junior Member
241 posts

Joined: Dec 2010
From: Cyberjaya

QUOTE(biatch0 @ Apr 20 2004, 11:42 PM)
First up, you'll need to grab all the relevant source distributions. THIS GUIDE DOES NOT DEAL WITH RPMs OF ANY SORT. Make sure you dump them somewhere you remember for convenience sake (I generally use /root/tmp and I will assume you do the same, otherwise, replace /root/tmp with your own dir). You can download the various source tar.gz files from the links below:
Apache - At time of writing: Apache 1.3.29
PHP - At time of writing: PHP 4.3.6
MySQL - At time of writing: MySQL 4.0.18
*
May I know whether should the Apache, PHP and MySQL sources be downloaded, compiled and installed onto only one single server?


Netto Hikari
post Feb 19 2012, 07:13 PM

Health and Fitness Consultant
*******
Senior Member
2,082 posts

Joined: Jan 2003
From: Selangor


Hope this guide help anyone that is new to this setup which I have just setup myself one of this which I google search.

Guide to setup a headless torrent box. - source: Build Media Server

How to install Deluge (v1.2.x/v1.3.x) headless on Ubuntu Server

Deluge is a great BitTorrent client that you can install on Ubuntu to allow you to share your favourite files with the rest of the BitTorrent community.

In the newer versions of Ubuntu, Deluge comes in two parts; the server (also called the daemon) and the user interface. This means you can install the Deluge daemon as a headless service and then control it from a remote machine. You can either control the daemon using the Deluge client itself (for example the Windows version of Deluge) or alternatively you can use your browser to control it. If you've not installed VNC and are running a purely headless setup then running Deluge headless is pretty much your only option! So, here's how you install it:

So, first off we need to create a new user called "deluge" and perform a couple more steps:
CODE
sudo adduser --disabled-password --system --home /var/lib/deluge --gecos "SamRo Deluge server" --group deluge
sudo touch /var/log/deluged.log
sudo touch /var/log/deluge-web.log
sudo chown deluge:deluge /var/log/deluge*


Install the Deluge Daemon and WebUI
Next we'll install the Deluge daemon itself:
CODE
sudo apt-get install deluged deluge-webui


Run the Deluge Daemon on startup
Now we've got the components installed we need to make everything run on start-up. So, let's create the first script we need by typing the following command in a Putty Session:

CODE
sudo vi /etc/default/deluge-daemon


This will create and open a file called deluge-daemon
Next, assuming you're using Putty, highlight the following 5 commands, right-click on them and select Copy

CODE
# Configuration for /etc/init.d/deluge-daemon
# The init.d script will only run if this variable non-empty.
DELUGED_USER="deluge"
# Should we run at startup?
RUN_AT_STARTUP="YES"


*when using vi, remember to enter "INSERT" mode before pasting anything. Check the first line to see if anything missing[\b]
Toggle back to the Putty Session and press the [Insert] key once and then right click and the 5 lines we've just copied above will be pasted into the file.

Now press the [Esc] key once and type [B]:wq
to save and quit out of the script. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.

Creating the "Init Script"

Now we need an "init script". This script is rather long but we can do some more copying and pasting to implement this script. So, type the following command in your Putty Session to create and open the script:

CODE
sudo vim /etc/init.d/deluge-daemon


Next, highlight and copy this script

Toggle back to your Putty Session and press the [Insert] key once and then right click and the whole script you've just highlighted will be pasted into the screen.

*when using vi, remember to enter "INSERT" mode before pasting anything. Check the first line to see if anything missing

Now to modified the script a little to fit your needs.

From this
CODE

DAEMON1_ARGS="-d -c /var/lib/deluge -l /var/log/deluged.log -L warning"
DAEMON2_ARGS="-p 9092 -c /var/lib/deluge -l /var/log/deluge-web.log -L warning"


To this
CODE

DAEMON1_ARGS="-d -p 9093 -c /var/lib/deluge -l /var/log/deluged.log -L warning"
DAEMON2_ARGS="-p 9092 -c /var/lib/deluge -l /var/log/deluge-web.log -L warning"


To enable "https" connection:
add --ssl in
CODE
DAEMON2_ARGS="-p 9092 --ssl -c /var/lib/deluge -l /var/log/deluge-web.log -L warning"


Anything else, please consult with deluge and deluged-web manual:

CODE
man deluge
man deluged-web


As before, press the [Esc] key once and type :wq to save and quit out of the script. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.

We now need to make this script executable. So:

CODE
sudo chmod a+x /etc/init.d/deluge-daemon


Now we need to make sure this script runs on start-up. To do this type the following command:

CODE
sudo update-rc.d deluge-daemon defaults


Cross your fingers and restart the server by typing the following command:

CODE
sudo shutdown -r now

or
CODE
sudo reboot -h now


Accessing Deluge via the web interface

You should now be able to access the Web front-end for Deluge by typing http://MyMediaserver:9092 into the address bar of your browser where MyMediaserver is the name you gave to your server when you installed Ubuntu. Alternatively the IP address of the server works just as well.

You should now be presented with the Deluge login-screen. Enter deluge for the password and you should then see a screen similar to this (Note: This is access from Windows 7):

Attached Image

Accessing Deluge via the Deluge client

Open the /var/lib/deluge/auth to edit:

CODE
sudo vi /var/lib/deluge/auth


Which will show you this for first time access:

CODE
localclient:a7bef72a890:10


Add a user and password to the authentication file (this does not have to be your server's user/pass):

CODE
username:password:level


where the authentication levels can be obtain from Deluge Authentication Support

Assuming that you have enable the deluge-webui than access it through the webui. Click on the Preferences icon (the screwdriver/spanner) on the Deluge web interface and select Daemon, check the Allow Remote Connections and change the Daemon port: if necessary.

Attached Image

Run the deluge client. Click on the Preferences icon (the screwdriver/spanner) on the Deluge client and select Interface. Untick the Classic Mode than restart your deluge client.

You will see something like this on the new start of the deluge client:

Attached Image

Click on Add. Enter your deluge server IP address or URL and port number for the deluge daemon running on your server. Enter your username and password created previously in the /var/lib/deluge

Opening the correct ports on your router

In order to start downloading Torrents you need to open up some ports on your router. If you click on the Preferences icon (the screwdriver/spanner) on the Deluge web interface and select Network, the Incoming Ports (the From: and To: ports inclusively) are the ports you need to open on your router. You can obviously change these ports if so wish, but make sure they match your router settings. Make sure you also uncheck the Use Random Ports option if you're going to be opening a specific port range on your router.

This post has been edited by Netto Hikari: Feb 19 2012, 07:20 PM
UbuntuClient
post Apr 22 2016, 11:41 AM

Regular
******
Senior Member
1,216 posts

Joined: Jun 2007
From: /kajang/putrajaya/cyberjaya/puchong



I'm not sure this right place or not.
CODE
iptables -A INPUT -p tcp --dport 80 -m state --state NEW -m limit --limit 100/sec -j ACCEPT

Base on rule from what i understand, server will accept new 100 packet to httpd. What happen if packet more than 100?
petirbuas
post Apr 22 2016, 12:23 PM

( 。◕ ‿‿ ◕。)
*****
Senior Member
888 posts

Joined: Dec 2009
From: The Internet



QUOTE(UbuntuClient @ Apr 22 2016, 11:41 AM)
I'm not sure this right place or not.
CODE
iptables -A INPUT -p tcp --dport 80 -m state --state NEW -m limit --limit 100/sec -j ACCEPT

Base on rule from what i understand, server will accept new 100 packet to httpd. What happen if packet more than 100?
*
All NEW connection will get rejected.

Packets are either ESTABLISHED, RELATED or NEW. So bear in mind that connection thats already ESTABLISHED will continue to be so.

This post has been edited by petirbuas: Apr 22 2016, 12:24 PM

 

Switch to:
| Lo-Fi Version
0.0380sec    10.30    6 queries    GZIP Disabled
Time is now: 25th February 2020 - 10:18 PM