Switching from a windows environment to Linux is a big change, the most obvious to overcome was knowing what commands to use to get information about your operating system. This is why I am putting this list together, to minimize the amount of search needed to find the right information.
This list will be updated from time to time.
ifconfig - this command is used to configure and control network interfaces, simply running this command will display the current state of your network interface.
netstat - combining switch with this command will will display a lot of useful information about your network, such as Routing Tables, all open ports, all listening ports and more.
This command will display a numeric routing table, (-n) tells the command to output IP address instead of hostname, (-r) prints the routing table on your screen.
Example: netstat -nr
This command will display all open ports.
Example: netstat -a
This will display all listening ports.
Example: netstat -l
Installing MySQL on Debian
apt-get install mysql-server mysql-client libmysqlclient-dev
mysqladmin -u root password yourrootsqlpassword
When you run netstat -tap you should now see a line like this:
tcp 0 0 localhost.localdo:mysql *:* LISTEN 2449/mysqld
Installing Apache, PHP and a few other modules
apt-get install apache2 apache2-doc
apt-get install php4 php4-cli php4-common php4-curl php4-dev php4-domxml php4-gd php4-imap php4-ldap php4-mcal php4-mhash php4-mysql php4-odbc php4-pear php4-xslt curl imagemagick
FreeRADIUS
Fetch FreeRADIUS and some tools:
apt-get install freeradius freeradius-mysql freeradius-dialupadmin
Apache Cheat Sheet
Setup a Virtual Domain
NameVirtualHost *
<VirtualHost * >
DocumentRoot /web/example.com/www
ServerName example.com
ServerAlias example.com
CustomLog /web/example.com/logs/access.log combined
ErrorLog /web/example.com/logs/error.log
</VirtualHost>
Include another conf file
Include /etc/apache/virtual-hosts/*.conf
Hide apache version info
ServerSignature Off
ServerTokens Prod
Custom 404 Error message
ErrorDocument 404 /404.html
Create a virtual directory (mod_alias)
Alias /common /web/common
Perminant redirect (mod_alias)
Redirect permanent /old http://example.com/new
Create a cgi-bin
ScriptAlias /cgi-bin/ /web/cgi-bin/
Process .cgi scripts
AddHandler cgi-script .cgi
Add a directory index
DirectoryIndex index.cfm index.cfm
Turn off directory browsing
Turn on directory browsing
<Location /images>
Options +Indexes
</Location>
Create a new user for basic auth (command line)
htpasswd -c /etc/apacheusers
Apache basic authentication
AuthName "Authentication Required"
AuthType Basic
AuthUserFile /etc/apacheusers
Require valid-user
Only allow access from a specific IP
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Only allow access from your subnet
Order Deny,Allow
Deny from all
Allow from 176.16.0.0/16
mod_rewrite
Turn on the rewrite engine
RewriteEngine On
Redirect /news/123 to /news.cfm?id=123
RewriteRule ^/news/([0-9]+)$ /news.cfm?id=$1 [PT,L]
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com$1 [R=301,L]
Recent comments