Create and work with compressed files

September 19th, 2010 by admin

Creating and working with compressed files in FreeBSD server is an easy task.

to compress a file you can use

#gzip filename

to compress each file in a directory,each file will be compressed in one file.

#gzip -r directory-name

to compress all files in a single archive:

#tar -zcvf  archive-name.gz directory-name.

to uncompress an archive:

#tar -zxvf archive-name.gz -C /directory-name

also to uncompress an archive:

#gzip -d archive.gz

to uncompress each file in a directory use

#gzip -d folder-name

Install Mono on FreeBSD step by step

September 18th, 2010 by admin

Mono is the Microsoft .net framework ported Open Source world and consists of runtime environment, compiler, and web server for handling ASP.NET web sites.

First step is install or update ports collection  using “#portsnap fetch”, then “#portsnap extract” or “#portsnap update”.

#cd /usr/ports/lang/mono

#make install clean
Then follow the configuration and setup options.

It will take some time to build, after installation, and build complete you can start your first c# application

#ee hellowolrd.cs

class Program
{
static void Main(string[] args)
{
System.Console.WriteLine(“Hello world, server time is:{0}”,System.DateTime.Now.ToString());
}
}

save the file and exit.

compile the file using mono compiler:

#/usr/local/bin/mcs hellowolrd.cs -r:System.Web.dll -r:System.Data.dll

run the hellowolrd application using:

# /usr/local/bin/mono helloworld.exe


What To Do when receive FreeBSD Dedicated Server from Hosting Company

September 18th, 2010 by admin

First of all you should be happy that you received your FreeBSD dedicated box.

Change passwords for  ssh admin login user, and root user, you can use command passwd.
Add more login users if you like.

It’s recomended to change the default ssh port 22 to something else to protect from spam.

Download and extract Ports Collection using commands:

  1. #portsnap fetch
  2. #portsnap extract

If Ports Collection already installed you can update it using :

  • #portsnap update

Update locate database lookup file to make it easy find and search files using command:

  • #/usr/libexec/locate.updated.

Start setup other software you need.
you cane use locate to find it for example search and install apache web server:
#locate apache

#cd /usr/ports/www/apache22

#make install

Change Default SSH Port to Protect FreeBSD server from daily spam attack

September 18th, 2010 by admin

Change Default SSH Port to Protect your FreeBSD server from daily spam attack.

# ee /etc/ssh/sshd_config

look for line #port 22 and change it to port 1234 then press Esc, save and exit.

reboot the server

#shutdown -r now

or type this command to reload SSH

# /etc/rc.d/sshd reload

Create a new user and Change User Password

September 18th, 2010 by admin

To Add a new user you can use adduser command, and it ask you for user information step by step.

To Change user password use passwd command

Example

#passwd Joo –> will let you change the password for user Joo.

#passwd  –> will let you change the password for current user.

Building secure Email Server

September 15th, 2010 by admin

FreeBSD comes by default with sendmail email server installed, but its not secure and scalable enough.

Building secure Email Server from scratch is a huge task, because it need many component to be installed and configured.

My objective was to build a secure, fast, reliable email server, very less and optimized system resource, using SSL, have a web interface for administration, web interface for clients, can be accessed by email clients application like Microsoft outlook and Microsoft outlook express, also my email server should be protected against spam and virus scan capabilities.

Secure Email Server component include:

  • Install and configure Apache  server.
  • Install and configure PHP.
  • Install and configure MySql server.
  • Create SSL/TLS certificate using openssl.
  • Install and configure Dovecot POP3/IMAP server.
  • Install and configure PostFix the alternative to Sendmail.
  • Install and configure PostFixAdmin.
  • Install and configure squirrelmail.
  • Install and configure SpamAssassin.

one of the best articles I found on the web, which go step by step to install a secure email server on FreeBSD here

FreeBSD Text based browser with Javascript support

August 7th, 2010 by admin

Sometimes I need to do some testing or just a quick browsing for a web site while working on FreeBSD server without any graphical interface, its only text mode.

one solution is to use links, to install links text browser just follow this steps:

  1. #cd /usr/ports/www/links1
  2. #make install clean

to start browsing just type

#links url

ex:

#links google.com

links can work with mouse also.

to get  links text browser menu press Esc and the links menu will appear which contain many options like file, view, download, setup, and help, to exit links text browser press q.

to get more inforamtion about links text based www web browser you can use:

  • #man links

links web site

Another solution for text browser is elinks which looks more recent with better functionality than links.

to setup elinks use:

  • #cd /usr/ports/www/elinks
  • #make install clean
  • configuration screen will appear then select the options you need.
  • to run elinks simply type  :
  • #elinks google.com

elinks website

unfortunately both links and elinks text browser is not supporting javascript.

so still looking for some thing else.

Install Drupal on FreeBSD step by step

June 30th, 2010 by admin

Drupal is an open source CMS,
To install drupal on FreeBSD you should have both Apache, and MySQL insalled and runing.

  1. Download Drupal using #wget http://ftp.drupal.org/files/projects/drupal-6.17.tar.gz
  2. decompress the file using #tar -zxvf drupal-6.17.tar.gz
  3. move the folder to your web home directory #mv drupal-6.17 /www/home/
  4. change the current directory to the new folder #cd /www/home/drupal-6.17
  5. copy the configuration file #cp sites/default/default.settings.php sites/default/settings.php
  6. change folder and file permission #chmod a+w sites/default/settings.php, #chmod a+w sites/default
  7. login to mysql database console #mysql -u user -p
  8. create a new database mysql>create database drupal6;
  9. change current database mysql>use mysql;
  10. create a new user mysql>create user drupal;
  11. give the required permission to the new user mysql>GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON drupal6.*  TO ‘drupal’@'localhost’ IDENTIFIED BY ‘pass@word’;
  12. add new section virtual alias in Apache server #ee /usr/local/etc/apache22/httpd.conf
  13. restart Apache server #/usr/local/sbin/apachectl stop , #/usr/local/sbin/apachectl start
  14. Browse your new web site and enter the database information.
  15. installation will start and a message will come : All necessary changes to ./sites/default and ./sites/default/settings.php  have been made, so you should remove write permissions.
  16. remove permission using #chmod a-w sites/default/settings.php,#chmod a-w sites/default
  17. complete adding administrator account.
  18. enjoy drupal.

Cheep and professional Dedicated Servers

June 17th, 2010 by admin

iWeb providing Effective and Scalable Web Hosting Solutions . Both Shared Web Hosting, and Dedicated Servers.

its cheep and professional.
Iweb

FreeBSD server status

June 9th, 2010 by admin

There is many tools and commands you can use to monitor the status of FreeBSD server like :

  • #top   , it will display the top processes on the system and  continue updates this  information, to exist press Ctrl+C
  • #last , it will list the sessions in reverse time order.
  • # cat /var/log/auth.log , it will disply auto.log info.
  • #cat /var/log/messages , it will disply messages info.
  • #netstat -r , it display a list of network status.
  • #freecolor , it display used/free Physical , and Swap memory.
  • #ps , to display process status.