Unix Tutorials

Steps To Fixing Linux Crash Filesystem After Power Outage.

Sometime if we didn't properly shutdown a server that running linux, it will cause a crash for the filesystem.
We need a tool that able to repair it immediately, the tool is FSCK or file system consistency check.

Below is the fsck command :


Usage: fsck [-sACVRTNP] [-t fs-optlist] [filesystem] [fs-specific-options]

Example :

I have a drive /home or /dev/sda3
Then the next step is we need a root access to run the command.

How To Moving All Websites Content Using Wget


Last Week i want to moving a large sites from one server to a new server.
There is a few method to moving all websites content to a brand new server,
First we can using RSYNC, FTP and WGET

In this tutorial i want to using WGET that will moved all sites content in a single line using FTP protocol

We need to prepare a FTP Login from an Old Server that currently host the websites
example :
ip new server :10.10.10.10
user : new
pass : newpassword123

FreeBSD Upgrade Packages Stop at pkg-config-0.25_1


When i want to upgrade all packages using portmaster to the latest packages
The portmaster shows me something like below :

===>  pkgconf-0.8.5 conflicts with installed package(s):
      pkg-config-0.25_1
 
      They install files into the same place.
      Please remove them first with pkg_delete(1).
*** Error code 1
 
Stop in /usr/ports/devel/pkgconf.

To solved this problem , We can just fixed it using pkg_delete

How To Install Apache 2.x To Work With GnuTLS

There is another way to using ssl with apache 2.x
The common solution is using OpenSSL with Apache 2.x

But right now i trying to get Apache 2.x to work with mod_gnutls

FYI, GnuTLS support TLS 1.2 and TLS 1.1 that also supported by OpenSSL
But GnuTLS will not supported SSL 2.0

We need to prepare anything related to GnuTLS to work with Apache 2.x
First we need to install those packages below :

Login as Root

1. GnuMP


#mkdir /root/temp
#cd /root/temp

How To Integrate AWStats With Apache Webserver in FreeBSD

What is AWStats ?


AWStats is a web statistics and log analyzer which create a statistics reports based on rich data from apache or server logs.

First We need to install AWStats in FreeBSD server
- Login into the FreeBSD server using SSH and root access
# cd /usr/ports/www/awstats
# make
# make install
# make clean

After AWStats is installed on the server we will need to configure our apache webserver.
Usually if we are installed Apache from ports then the apache config files will be stored in
/usr/local/etc/apache22/httpd.conf

How To Solved Mysqldump: Got error: 1016: Can't Open file when using LOCK Tables

Today, i trying to dump my database but when the dump process begin,
MySQL shows error like below :

Example :

root@rainforest# mysqldump -u root -p mypassword --opt sampledb > backupdb.sql
mysqldump: Got error: 1016: Can't open file: './sampledb/xxx.frm' (errno: 24) when using LOCK TABLES
root@rainforest#

So after googling a way to dump it without any hassle

root@rainforest# mysqldump -u root -p mypassword --opt sampledb --lock-tables=fales > backupdb.sql

From the command above, i can dump my backupdb without any problem

How To Rewrite www to non-www domain using htaccess

Here is a simple way to rewrite your domain from www.yourdomain.com to yourdomain.com without www

This is simply add few lines into your .htaccess files.

Below is the example how to do that

 

<IfModule mod_rewrite.c>
  RewriteEngine on

 RewriteCond %{HTTP_HOST} ^www\.wowtutorial\.org$ [NC]
  RewriteRule ^(.*)$ http://wowtutorial.org/$1 [L,R=301]

</IfModule>

Change it to your domain name.
After that tested it out again.

This should be working

 

How To Using Nginx Rewrite From www to non-www FQDN



Here is a simple way to rewrite your domain name from www.example.com to example.com without www.
We just need to set a rewrite rules in nginx like sample below :

Login as root into your server
Edit nginx.conf

#pico /etc/nginx.conf

if ($host = 'www.example.com') {
         rewrite  ^/(.*)$  http://example.com/$1  permanent;
}

After that save the nginx.conf and restart nginx

#nginx -s reload

How To Show Shared Directory from NFS Server Linux


First, we need to know what is NFS ?
NFS is a network file system something like a distributed file system protocol that allowing user on a client computer to access files over network.

For Example : we have few NFS server here and we want to know
how to see all exported file system from unix server using a command line linux

We can using showmount command to see the mount information from NFS server.

Example we have a NFS server named : media10 and the ip address : 10.100.100.1

How To Find a Hidden Process and Port in Linux and Unix Operating System


There are so many tools that able to check the hidden process and port, the tools are rootkits/lkms/unhide etc.
In this tutorial i will discuss something more simple to use and the tools is UNHIDE.

Unhide is a tool to find hidden processes and TCP/UDP ports by rootkits / LKMs or by another hidden technique. This tools works under both Linux / Unix, and MS-Windows operating systems.

It detects hidden processes using three techniques:

The proc technique consists of comparing /proc with the output of /bin/ps.
The sys technique consists of comparing information gathered from /bin/ps with information gathered from system calls.
The brute technique consists of bruteforcing the all process IDs. This technique is only available on Linux 2.6 kernels.

Facebook Fans