JavaScript Countdown

Kode di web:

<script language="JavaScript">
TargetDate = "12/31/2020 5:00 AM";
BackColor = "palegreen";
ForeColor = "navy";
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!";
</script>
<script language="JavaScript" src="http://yourdomain.com/countdown.js"></script>

file countdown.js

/*
Author: Robert Hashemian
http://www.hashemian.com/

You can use this code in any manner so long as the author's
name, Web address and this disclaimer is kept intact.
********************************************************
Usage Sample:

<script language="JavaScript">
TargetDate = "12/31/2020 5:00 AM";
BackColor = "palegreen";
ForeColor = "navy";
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!";
</script>
<script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script>
*/

function calcage(secs, num1, num2) {
  s = ((Math.floor(secs/num1))%num2).toString();
  if (LeadingZero && s.length < 2)
    s = "0" + s;
  return "<b>" + s + "</b>";
}

function CountBack(secs) {
  if (secs < 0) {
    document.getElementById("cntdwn").innerHTML = FinishMessage;
    return;
  }
  DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
  DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));

  document.getElementById("cntdwn").innerHTML = DisplayStr;
  if (CountActive)
    setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod);
}

function putspan(backcolor, forecolor) {
 document.write("<span id='cntdwn' style='background-color:" + backcolor + 
                "; color:" + forecolor + "'></span>");
}

if (typeof(BackColor)=="undefined")
  BackColor = "white";
if (typeof(ForeColor)=="undefined")
  ForeColor= "black";
if (typeof(TargetDate)=="undefined")
  TargetDate = "12/31/2020 5:00 AM";
if (typeof(DisplayFormat)=="undefined")
  DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
if (typeof(CountActive)=="undefined")
  CountActive = true;
if (typeof(FinishMessage)=="undefined")
  FinishMessage = "";
if (typeof(CountStepper)!="number")
  CountStepper = -1;
if (typeof(LeadingZero)=="undefined")
  LeadingZero = true;

CountStepper = Math.ceil(CountStepper);
if (CountStepper == 0)
  CountActive = false;
var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990;
putspan(BackColor, ForeColor);
var dthen = new Date(TargetDate);
var dnow = new Date();
if(CountStepper>0)
  ddiff = new Date(dnow-dthen);
else
  ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
CountBack(gsecs);

__________________________________________________

Sumber: http://www.hashemian.com/tools/javascript-countdown.htm

Lupa Password phpmyadmin

Matikan service mysqld :

 sudo /etc/init.d/mysql stop

Lalu aktifkan kembali dengan menambahkan –skip-grant-tables –user=root , option ini dipilih agar melewatkan (skip) proses autentifikasi :

sudo mysqld_safe --skip-grant-table --user=root

Kemudian masuk ke mysql :

sudo mysql -u root

Kemudian rubah password user (saya menggunakan user root) dengan cara :

UPDATE mysql.user SET Password=PASSWORD('MyNewPassword') WHERE user='root';
FLUSH PRIVILEGES;

Kemudian restart ulang service mysql-nya :

sudo /etc/init.d/mysql restart

Lalu ubah konfigurasi php pada file configuration.php untuk menyamakan password phpmyadmin yang tadi dirubah.

_______________________________

Sumber : http://kusumartono.wordpress.com/2010/06/10/lupa-password-phpmyadmin/

Create a separate home partition in Ubuntu

Note: I no longer maintain this tutorial. It works fine for me and a lot of other users, but some people have complained that it doesn’t work for them, and I don’t frankly know enough about this process to help people troubleshoot following these steps.

If this works for you, great. Otherwise, you can try the community site:
https://help.ubuntu.com/community/Partitioning/Home/Moving

For help with this, please post on the Ubuntu Forums.

Introduction
Disclaimers
Requirements
Making the new partition
Using the new partition
What if it doesn’t work?

Introduction

This guide is for creating a separate /home partition if you already installed Ubuntu withouta /home partition (i.e., /home is just a folder inside your / partition).

Having a separate /home partition makes it easier for you to reinstall Ubuntu while preserving your personal files and settings. This is a matter of convenience but is not foolproof. You should still regularly back up your data.

Important Disclaimers

  • Even though I created the form of this tutorial, the steps outlined in it are taken directly from a text-only (command-line-driven) guide for this process. If you believe there is something wrong with the steps, leave a comment on that guide. I did not create these steps. I just was able to follow them successfully myself and wanted to present them in a more new-user-friendly form.
  • I and others have been successful in creating a separate /home partition using this tutorial, but there are many who have had difficulty being successful with the process. If you are not confident in what you’re doing or in repairing or recovering from this process should anything go wrong, then do not attempt the instructions outlined here. I cannot help you troubleshoot problems that result from following this tutorial.
  • In this tutorial, I used extremely small partition sizes just for the purposes of creating more up-to-date screenshots. If you have less than 30 GB of hard drive space, I would not recommend creating a separate /home partition.
  • Creating a separate /home partition involves resizing at least one existing partition. In almost all cases, the resizing of partitions does not result in data loss, but there still exists a (however small) risk of data loss, so you should back up your important data before attempting to resize your partitions.

Requirements

You must use a live CD for this process, for two reasons:

  1. In order to resize your existing / partition, it needs to be unmounted. The only way to unmount it is for it not to be in use, which means you can’t boot to your regular Ubuntu installation while resizing it… which means you need a live CD. By default, the Ubuntu live CD does not automatically mount internal partitions and drives, but if you happen to notice the drive appear on the desktop, right-click it to unmount it before starting this process.
  2. If you screw up your installation by accident, you can use the live CD to restore your old settings and, in the worst situation, at least recover your important files

I’m using the example of a Ubuntu Desktop CD and GParted, but you can very well use QTParted on Knoppix or DiskDrake on PCLinuxOS.

Making the new partition

Boot up the Ubuntu Desktop CD and choose to try Ubuntu without installing it.


Once the desktop has loaded, go to System > Administration > Partition Editor to launch GParted.


In GParted, find the partition you want to resize in order to make room for your upcoming /home partition. In this case, I’m resizing /dev/sda1, but your partition may be different. Be sure to keep track of the names of your partitions—these names are very important (/dev/hda1, /dev/hdb1, /dev/sda2, etc.).

To make room for your new (soon-to-be-/home) partition, right-click an existing partition and select Resize/Move


With your mouse, grab the right side of the partition and drag it to the size you want. Then click Resize/Move


You should now see some new space called unallocated. Select it with your mouse and then go to Partition and select New.


Under Filesystem, select Ext3. Then click Add.


Once you have the partitions set up the way you want, click Apply in the main menu and then click Apply in the resulting confirmation dialogue to apply the changes.


Wait for the changes to finish being applied, click Close, and then quit GParted.

Now, in my example, my original partition that I shrunk was /dev/sda1, and it created a new partition called /dev/sda3, and my /home folder at this point still lives on /dev/sda1. It’s very important that you substitute in your own appropriate partition names for the ones I’m using.

Using the new partition


Go to Applications > Accessories > Terminalto launch the terminal.

Now, back in the terminal, I’m going to mount /dev/sda1 and /dev/sda3 by pasting in these commands (please remember to change the partition device names to the ones appropriate for your setup):

sudo mkdir /old
 sudo mount -t ext3 /dev/sda1 /old
 sudo mkdir /new
 sudo mount -t ext3 /dev/sda3 /new

Now we’re going to back up the /home directory on the old partition and move it to the new partition:

cd /old/home
 find . -depth -print0 | cpio --null --sparse -pvd /new/
 sudo mv /old/home /old/home_backup
 sudo mkdir /old/home

Yes, one of those lines looks really complicated—so please copy and paste the commands into the terminal instead of retyping them.

Note: I have tested the second command myself, and it works, but some have pointed out it might make sense to preface the commands with sudo in case one of the other users has subdirectories manually marked as unreadable to the user making the move. Since I have not tested this out and all directories and readable to all by default, I’m offering this as only an alternative in case the command as given does not work:
sudo find . -depth -print0 | sudo cpio –null –sparse -pvd /new/

Next, we’re going to specify to use the new home partition as /home:

sudo cp /old/etc/fstab /old/etc/fstab_backup
 gksudo gedit /old/etc/fstab

You’ll then see the /etc/fstab file opened in the Gedit text editor. Add in this line at the end of the file:

/dev/sda3 /home ext3 nodev,nosuid 0 2

Save the file and exit Gedit.

After you reboot, you should be now using your new /home partition.

If you find that you are running out of room on your old partition and you’re pretty confident everything is working as it should be, then go ahead and delete the backup of home:

sudo rm -rf /home_backup

It’s very important you paste in the above command. Retyping it could be extremely dangerous if you mess up, and you could end up deleting your entire installation.

What if it doesn’t work?

If you reboot and are unable to log in because of some errors having to do with the $HOME/.dmrc file and/or .ICEauthority file, this may help.

Boot into recovery mode (if you don’t know how to do this, go to this section of another tutorial).


Once in recovery mode, type (unfortunately, you won’t be able to copy and paste, so please be careful what you type)

chown -R username:username /home/username
 chmod 644 /home/username/.dmrc
 chmod 644 /home/username/.ICEauthority
 exit

where username is your actual username. Obviously, you’d repeat the first three commands for all users experiencing the problem before you typed exit.


Once you’ve exited recovery mode, resume the normal boot and log in.

If, for some reason, no matter what you try, the separate /home doesn’t work, that’s why we have a live CD, so we can fix things.

Boot up the live CD, go to a terminal, and paste in (being sure to change the partition device name, of course):

sudo mkdir /recovery
 sudo mount -t ext3 /dev/sda1 /recovery
 sudo cp -R /recovery/home_backup /recovery/home
 sudo cp /recovery/etc/fstab_backup /recovery/etc/fstab

Then, reboot.

__________________________________

sumber : http://www.psychocats.net/ubuntu/separatehome

Mounting Linux Partitions in Ubuntu

If you plug in an external hard drive with a Linux filesystem, it will automount and show up on your desktop, just like any external media. But what if you have an internalhard drive or partition with a Linux filesystem? Well, that’s what this tutorial is about.

Warning: The tutorial on this page is for an internal drive that will serve as an extra data partition. If you would like to mount a separate drive or partition as /home instead, you want a different tutorial.

First you have to determine what the partition is called and what filesystem it is. One quick way to do it if you know what filesystem you formatted the drive as (Ext3, for example) is to just type the terminal command

sudo fdisk -l

Here’s how it could come out:

Disk /dev/sda: 8589 MB, 8589934592 bytes
 255 heads, 63 sectors/track, 1044 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disk identifier: 0x000eb4baDevice Boot Start End Blocks Id System
 /dev/sda1 * 1 524 4208006 83 Linux
 /dev/sda2 525 1044 4176900 83 Linux

As you can see, I’m able to locate that /dev/sda2 is my Linux partition, but in System, I don’t find out if it’s Ext3, Ext4, Reiserfs, or what it is. If I happen to know it’s Ext4, cool.

But let’s say I didn’t know. Well, one way to find out for sure is to install GParted and find out:

sudo apt-get update
 sudo apt-get install gparted gksu
 gksudo gparted

 

 

 

 

 

 

 

 

 

You can go to System > Administration > GParted and enter your password to get it started.

 

 

 

 

 

 

 

 

 

 

Ah, now I can definitely see it’s Ext4 for sure. Under Partition I see it’s /dev/sda2, and under Filesystem, I see it’s Ext4.

If you have a second physical hard drive (not just another partition), you might have to click on the top-right corner to focus on the second hard drive. (Click on the down-pointing arrow to get the drop-down menu.)

So now I’ll create a mount point for that partition:

sudo mkdir /storage

Next, I want to determine the UUID of my partition.***

ls -l /dev/disk/by-uuid

and I get back this output:

total 0
 lrwxrwxrwx 1 root root 10 2010-04-26 12:00 20bfd80a-a96b-461c-a63d-c96ff8e95872 -> ../../sda1
 lrwxrwxrwx 1 root root 10 2010-04-26 19:19 d1d0cf46-958f-4a12-a604-0ac66040648b -> ../../sda2

Then I’ll edit my /etc/fstab file:

sudo cp /etc/fstab /etc/fstab_backup
 sudo nano /etc/fstab

Once in there, I should add in this line:

UUID=d1d0cf46-958f-4a12-a604-0ac66040648b /storage ext4 defaults 0 0

Then I can save (Control-X), confirm (Y), and exit (Enter).

Since we’ve made changes to the /etc/fstab file, we need to have Ubuntu acknowledge those changes:

sudo mount -a

Now I need to give it the proper permissions. Let’s just assume, for this example, that my username is jessica.

sudo chown -R jessica:jessica /storage
 sudo chmod -R 755 /storage

Now the partition is mounted in the /storage folder and is ready for use!

*** Yes, I could just use the name of it (/dev/sda2), but UUID is more precise. It’s unlikely that I’ll unplug my internal drive, plug in a new internal drive, and then plug back in my original internal drive so that the partition names are reassigned. Still, it’s safer to use the exact partition identifier in /etc/fstab.

___________________________________

sumber : http://www.psychocats.net/ubuntu/mountlinux

WordPress Media: Increase Maximum Upload File Size

In WordPress Media Manager, the default settings for “maximum upload file size” seem to come out different for each installation, depending on the server. Most often, the max size is descent enough to live with, but after a recent install was only offering an insultingly low 2MB, I figured it’s best to be prepared to increase this value quickly & painlessly.

Step-by-Step

1. Locate a file called php.ini. If you have SSH access, that’s great. You may find it with this:
php -i | grep php.ini
Otherwise, logon to your server via your FTP client and look in the root folder, as well as public_html. Don’t worry if you can’t find it – you can make one yourself by creating a text file and saving it as php.ini.

2. Insert the following text into the php.ini file:


memory_limit = 100M
upload_max_filesize = 64M
post_max_size = 64M
file_uploads = On

Go ahead and change the numeric values to your preferences.

3. Place the modified file. There are a number of locations to place the file, and different things seem to work for different people. If you modified a pre-existing file, try putting it back where you found it. Of course I recommend what worked for me, which is placing it inside the /wordpress/wp-admin folder. This may also be desirable because it will only affect that area of your site.

4. Modify wp-config.php. Add the following code to wp-config.php in order to match the desired file size:


/* Increases max file size for uploads */
define('WP_MEMORY_LIMIT', '64M');

Again, go ahead and change the numeric value to fit your preference.

5. Troubleshooting. If it doesn’t work right away, be sure to experiment with the location of the php.ini. One of these four locations should work: Root folder, public_html, wordpress (your wordpress install), or wordpress/wp-admin. In some cases, the .ini file may need to be renamed to php5.ini. Try both files in each location until the WordPress Media Manager reads “Maximum upload file size: 64MB”.

_________________________________

sumber : http://www.lanexa.net/2011/04/wordpress-media-increase-maximum-upload-file-size/

20 ways to Secure your Apache Configuration

Here are 20 things you can do to make your apache configuration more secure.

Disclaimer: The thing about security is that there are no guarantees or absolutes. These suggestions should make your server a bit tighter, but don’t think your server is necessarily secure after following these suggestions.

Additionally some of these suggestions may decrease performance, or cause problems due to your environment. It is up to you to determine if any of the changes I suggest are not compatible with your requirements. In other words proceed at your own risk.

First, make sure you’ve installed latest security patches

There is no sense in putting locks on the windows, if your door is wide open. As such, if you’re not patched up there isn’t really much point in continuing any longer on this list. Go ahead and bookmark this page so you can come back later, and patch your server.

Hide the Apache Version number, and other sensitive information.

By default many Apache installations tell the world what version of Apache you’re running, what operating system/version you’re running, and even what Apache Modules are installed on the server. Attackers can use this information to their advantage when performing an attack. It also sends the message that you have left most defaults alone.

There are two directives that you need to add, or edit in your httpd.conf file:

ServerSignature Off
ServerTokens Prod

The ServerSignature appears on the bottom of pages generated by apache such as 404 pages, directory listings, etc.

The ServerTokens directive is used to determine what Apache will put in the Server HTTP response header. By setting it to Prod it sets the HTTP response header as follows:

Server: Apache

If you’re super paranoid you could change this to something other than “Apache” by editing the source code, or by using mod_security (see below).

Make sure apache is running under its own user account and group

Several apache installations have it run as the user nobody. So suppose both Apache, and your mail server were running as nobody an attack through Apache may allow the mail server to also be compromised, and vise versa.

User apache
Group apache

Ensure that files outside the web root are not served

We don’t want apache to be able to access any files out side of its web root. So assuming all your web sites are placed under one directory (we will call this /web), you would set it up as follows:

<Directory />
  Order Deny,Allow
  Deny from all
  Options None
  AllowOverride None
</Directory>
<Directory /web>
  Order Allow,Deny
  Allow from all
</Directory>

Note that because we set Options None and AllowOverride None this will turn off all options and overrides for the server. You now have to add them explicitly for each directory that requires an Option or Override.

Turn off directory browsing

You can do this with an Options directive inside a Directory tag. Set Options to either None or -Indexes

Options -Indexes

Turn off server side includes

This is also done with the Options directive inside a Directory tag. Set Options to either None or -Includes

Options -Includes

Turn off CGI execution

If you’re not using CGI turn it off with the Options directive inside a Directory tag. Set Options to either None or -ExecCGI

Options -ExecCGI

Don’t allow apache to follow symbolic links

This can again can be done using the Options directive inside a Directory tag. Set Options to either None or -FollowSymLinks

Options -FollowSymLinks

Turning off multiple Options

If you want to turn off all Options simply use:

Options None

If you only want to turn off some separate each option with a space in your Options directive:

Options -ExecCGI -FollowSymLinks -Indexes

Turn off support for .htaccess files

This is done in a Directory tag but with the AllowOverride directive. Set it to None.

AllowOverride None

If you require Overrides ensure that they cannot be downloaded, and/or change the name to something other than .htaccess. For example we could change it to .httpdoverride, and block all files that start with .ht from being downloaded as follows:

AccessFileName .httpdoverride
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>

Run mod_security

mod_security is a super handy Apache module written by Ivan Ristic, the author of Apache Security from O’Reilly press.

You can do the following with mod_security:

  • Simple filtering
  • Regular Expression based filtering
  • URL Encoding Validation
  • Unicode Encoding Validation
  • Auditing
  • Null byte attack prevention
  • Upload memory limits
  • Server identity masking
  • Built in Chroot support
  • And more

Disable any unnecessary modules

Apache typically comes with several modules installed. Go through the apache module documentation and learn what each module you have enabled actually does. Many times you will find that you don’t need to have the said module enabled.

Look for lines in your httpd.conf that contain LoadModule. To disable the module you can typically just add a # at the beginning of the line. To search for modules run:

grep LoadModule httpd.conf

Here are some modules that are typically enabled but often not needed: mod_imap, mod_include, mod_info, mod_userdir, mod_status, mod_cgi, mod_autoindex.

Make sure only root has read access to apache’s config and binaries

This can be done assuming your apache installation is located at /usr/local/apache as follows:

chown -R root:root /usr/local/apache
chmod -R o-rwx /usr/local/apache

Lower the Timeout value

By default the Timeout directive is set to 300 seconds. You can decrease help mitigate the potential effects of a denial of service attack.

Timeout 45

Limiting large requests

Apache has several directives that allow you to limit the size of a request, this can also be useful for mitigating the effects of a denial of service attack.

A good place to start is the LimitRequestBody directive. This directive is set to unlimited by default. If you are allowing file uploads of no larger than 1MB, you could set this setting to something like:

LimitRequestBody 1048576

If you’re not allowing file uploads you can set it even smaller.

Some other directives to look at are LimitRequestFields, LimitRequestFieldSize and LimitRequestLine. These directives are set to a reasonable defaults for most servers, but you may want to tweak them to best fit your needs. See the documentation for more info.

Limiting the size of an XML Body

If you’re running mod_dav (typically used with subversion) then you may want to limit the max size of an XML request body. The LimitXMLRequestBody directive is only available on Apache 2, and its default value is 1 million bytes (approx 1mb). Many tutorials will have you set this value to 0 which means files of any size may be uploaded, which may be necessary if you’re using WebDAV to upload large files, but if you’re simply using it for source control, you can probably get away with setting an upper bound, such as 10mb:

LimitXMLRequestBody 10485760

Limiting Concurrency

Apache has several configuration settings that can be used to adjust handling of concurrent requests. The MaxClients is the maximum number of child processes that will be created to serve requests. This may be set too high if your server doesn’t have enough memory to handle a large number of concurrent requests.

Other directives such as MaxSpareServers, MaxRequestsPerChild, and on Apache2 ThreadsPerChild, ServerLimit, and MaxSpareThreads are important to adjust to match your operating system, and hardware.

Restricting Access by IP

If you have a resource that should only by accessed by a certain network, or IP address you can enforce this in your apache configuration. For instance if you want to restrict access to your intranet to allow only the 176.16 network:

Order Deny,Allow
Deny from all
Allow from 176.16.0.0/16

Or by IP:

Order Deny,Allow
Deny from all
Allow from 127.0.0.1

Adjusting KeepAlive settings

According to the Apache documentation using HTTP Keep Alive’s can improve client performance by as much as 50%, so be careful before changing these settings, you will be trading performance for a slight denial of service mitigation.

KeepAlive’s are turned on by default and you should leave them on, but you may consider changing the MaxKeepAliveRequests which defaults to 100, and the KeepAliveTimeout which defaults to 15. Analyze your log files to determine the appropriate values.

Run Apache in a Chroot environment

chroot allows you to run a program in its own isolated jail. This prevents a break in on one service from being able to effect anything else on the server.

It can be fairly tricky to set this up using chroot due to library dependencies. I mentioned above that the mod_security module has built in chroot support. It makes the process as simple as adding a mod_security directive to your configuration:

SecChrootDir /chroot/apache

There are however some caveats however, so check out the docs for more info.

Acknowledgments

I have found the book Apache Security to be a highly valuable resource for securing an apache web server. Some of the suggestions listed above were inspired by this book.

Suggestions

Please post any suggestions, caveats, or corrections in the comments and I will update the post if necessary.

digg this!

_________________________________

sumber : http://www.petefreitag.com/item/505.cfm

Adding a New Disk Drive to an Ubuntu Linux System

One of the first problems encountered by users these days is that they run out of disk space to store data. Fortunately disk space is now one of the cheapest of all IT commodities. In this chapter we will look at the steps necessary to integrate a new disk drive into an Ubuntu system.

Getting Started

This tutorial assumes that the new physical hard drive has been installed on the system and is visible to the operating system. The best way to do this is to enter the system BIOS setup during the boot process and ensure that the BIOS sees the disk drive. Sometimes the BIOS will provide a menu option to scan for new drives. If the BIOS does not see the disk drive double check the connectors and jumper settings (if any) on the drive.

Finding the New Hard Drive in Ubuntu

Assuming the drive is visible to the BIOS it should automatically be detected by the operating system. Typically, the disk drives in a system are assigned device names beginning hd or sd followed by a letter to indicate the device number. For example, the first device might be /dev/sda, the second /dev/sdb and so on.

The following is output from a system with only one physical disk drive:

ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sda5

This shows that the disk drive represented by /dev/sda is itself divided into three partitions, represented by /dev/sda1, /dev/sda2 and /dev/sda5.

The following output is from the same system after a second hard disk drive has been installed and detected by the operating system:

ls /dev/sd*
/dev/sda   /dev/sda1  /dev/sda2 /dev/sda5 /dev/sdb

As shown above, the new hard drive has been assigned to the device file /dev/sdb. At this point the drive has no partitions shown (because we have yet to create any).

Creating Linux Partitions

The next step is to create one or more Linux partitions on the new disk drive. This is achieved using the fdisk utility which takes as a command-line argument the device to be partitioned (in this case /dev/sdb):

sudo fdisk /dev/sdb
[sudo] password for johndoe:
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xc2fe324b.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help):

In order to view the current partitions on the disk enter the p command:

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xc2fe324b

   Device Boot      Start         End      Blocks   Id  System

As we can see from the above fdisk output, the disk currently has no partitions because it is a previously unused disk. The next step is to create a new partition on the disk, a task which is performed by entering n (for new partition) and p (for primary partition):

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4):

In this example we only plan to create one partition which will be partition 1. Next we need to specify where the partition will begin and end. Since this is the first partition we need it to start at cylinder 1 and since we want to use the entire disk we specify the last cylinder as the end. Note that if you wish to create multiple partitions you can specify the size of each partition by cylinders, bytes, kilobytes or megabytes.

Partition number (1-4): 1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261

Now that we have specified the partition we need to write it to the disk using the w command:

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

If we now look at the devices again we will see that the new partition is visible as /dev/sdb1:

ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sda5 /dev/sdb  /dev/sdb1

Now that the disk has been successfully partitioned, the next step is to create a file system on our new partition.

Creating a Filesystem on an Ubuntu Disk Partition

We now have a new disk installed, it is visible to Ubuntu and we have configured a Linux partition on the disk. The next step is to create a Linux file system on the partition so that the operating system can use it to store files and data. The easiest way to create a file system on a partition is to use the mkfs.ext3 utility which takes as arguments the label and the partition device:

sudo mkfs.ext3 -L /photos /dev/sdb1
mke2fs 1.40.2 (12-Jul-2007)
Filesystem label=/photos
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
262144 inodes, 524112 blocks
26205 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Mounting a Filesystem

Now that we have created a new file system on the Linux partition of our new disk drive we need to mount it so that it is accessible. In order to do this we need to create a mount point. A mount point is simply a directory into which the file system will be mounted. For the purposes of this example we will create a /photos directory to match our file system label (although it is not necessary that these values match):

sudo mkdir /photos

The file system may then be manually mounted using the mount command:

sudo mount /dev/sdb1 /photos

Running the mount command with no arguments shows us all currently mounted file systems (including our new file system):

mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.22-14-generic/volatile type tmpfs (rw)
securityfs on /sys/kernel/security type securityfs (rw)
/dev/sdb1 on /photos type ext3 (rw)

Configuring Ubuntu to Automatically Mount a Filesystem

In order to set up the system so that the new file system is automatically mounted at boot time, an entry needs to be added to the /etc/fstab file. This may be edited by issuing the following command in a terminal window:

sudo gedit /etc/fstab

The following example shows an /etc/fstab file configured to automount our /photos partition:

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/sda1
UUID=4a621e4d-8c8b-4b39-8934-98ab8aa52ebc /               ext3    defaults,errors=remount-ro 0       1
# /dev/sda5
UUID=9c82bf09-c6f7-4042-8927-34e46518b224 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec 0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec 0       0
/dev/sdb1       /photos         auto    defaults        0       0

_____________________________________

sumber: http://www.techotopia.com/index.php/Adding_a_New_Disk_Drive_to_an_Ubuntu_Linux_System

Add a second drive to your Ubuntu server

You have your Ubuntu Server up and running (with the help of “Installing Ubuntu Server 9.04“) but you’re afraid you’ll run out of room on your drive. To solve this problem you have installed a new hard drive, but because this is a GUI-less server you do not have access to the user-friendly GUI tools that make this job easy. So you’re going to have to install this drive with the help of the command line.

GASP!

Never fear, it’s not that hard. Just a few commands and you’ll be up and running with your new hard drive installed on your server. This article will assume the physical drive is already installed on your machine.

I am going to make a couple of assumptions here, for the sake of simplicity for this article. The first assumption is that the new drive will be mounted to the directory /data. The next assumption is that you want this directory to be both readable and writable by all users on the system. Another assumption is that you will want the drive to be formatted with the ext3 file system with just one partition. Finally I will assume you want this drive to be automatically mounted upon boot of the system.

With that out of the way, let’s get down to business.

Once you boot the machine with the new drive log into the console and issue the command:

dmesg

Near the bottom of the output you should see where the disk is located. it will be something like:

/dev/sdb

So let’s assume it is on /dev/sdb.

If you can’t figure it out where the drive is located  with dmesg issue the command:

sudo fdisk -l

The above command will report something like:

/dev/sda1 * 1 18709 150280011 83 Linux
/dev/sda2 18710 19457 6008310 5 Extended
/dev/sda5 18710 19457 6008278+ 82 Linux swap / Solaris

But will include a listing for your new drive. If you only see listings for /dev/sda* then your new drive has not been recognized and there is a problem with the physical installation.

Once you know where your drive is located (again we’ll use /dev/sdb for our example) it’s time to create a new directory where this drive will be mounted. We are mounting our drive to the directory /data so we’ll create this directory with the following command:

sudo mkdir /data

Now let’s make it available to all users:

sudo chmod -R 777 /data

With a place to mount the drive, it’s time to format the new drive. The formatting will be done with the command:

sudo mkfs.ext3 /dev/sdb

When this is complete you are ready to mount the drive. Before you edit fstab entry (so the drive will be automatically mounted) make sure it can be successfully mounted with the command:

sudo mount /dev/sdb /data

If this is successful let’s create an entry in /etc/fstab. open that file with the command

sudo nano /etc/fstab

Now add the following entry at the end of that file:

/dev/sdb /data ext3 defaults 0 0

Once you save that file, mount the drive (without having to reboot) with the command:

sudo mount -a

To make sure the drive mounted successfully issue the command:

df

The above should include in the report:

/dev/sdb   /data

If that’s the case, success! You can run one file test by trying to write a file to the new drive with the command:

touch /data/test

If you can write that file all is well.

Final thoughts

Yes it is a bit more complicated than adding a new drive when you have GUI tools available, but it’s not anything that can’t be accomplished by the average user. If you are not afraid of the command line, you can add a second drive in Ubuntu with ease.

_________________________________

sumber: http://www.ghacks.net/2009/09/10/add-a-second-drive-to-your-ubuntu-server/

Ubuntu 10.10 WordPress Installation

 

Sumber: http://www.youtube.com/watch?v=DCFy73ZCrTs

In this video I download and configure WordPress for Ubuntu 10.10 LAMP server. Before you can configure WordPress you will need to have the LAMP server already installed as well as phpmyadmin. I download the wordpress files, extract them, change the permissions of the /var/www folder and then configure WordPress.

mirror video

Instalasi dan Konfigurasi LAMP server di Ubuntu 9.04 (Jaunty Jackalope)

Berikut ini adalah cara saya menginstal LAMP (LinuxApacheMySQL-PHP) di Ubuntu 9.04 (Jaunty Jackalope) versi Desktop yang saya gunakan saat ini di notebook saya untuk belajar CMS Drupal secara lokal. Nantinya saya akan menjalankan Drupal dengan URL mengarah kepada localhost. Sebenarnya panduan singkat ini sebelumnya saya rencanakan untuk demo instalasi wordpress pada Ubuntu(untuk Guru Komputer) di Lab Komputer tempat kerja saya minggu lalu, namun karena waktu pertemuan yang terbatas sehingga tidak jadi dilaksanakan. So, saya publish saja disini..

Instalasi LAMP:

Saya biasanya menggunakan Synaptic Package Manager dan command apt-get (lebih sering menggunakan apt-get karena lebih cepat). Repository paket langsung dari internet yang dihubungkan melalui Proxy Server di tempat kerja saya.

  1. Dari desktop Gnome, pilih System -> Administration -> Synaptic Package Manager.
  2. Setelah berada pada window Synaptic Package Manager, pilih Edit -> Mark Packages by Task.
  3. Kemudian pilih LAMP server dan jalankan instalasinya.
  4. Untuk instal phpMyAdmin, silahkan Search dan ketikkan phpmyadmin.

Jika rekan-rekan ingin menggunakan command apt-get atau aptitude:

  1. Instal Apache:
    sudo apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2-suexec libexpat1 ssl-cert
  2. Instal PHP:
    sudo apt-get install libapache2-mod-php5 libapache2-mod-ruby libapache2-mod-python php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
  3. Instal MySQL:
    sudo apt-get install mysql-server mysql-client libmysqlclient15-dev
  4. Instal phpMyAdmin:
    sudo apt-get install phpmyadmin

Konfigurasi Web Server Apache:

  • Edit file /etc/apache2/sites-enabled/000-default, rubah pada bagian:
<directory /var/www/>

Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

menjadi:

<directory /var/www/>

Options Indexes FollowSymLinks MultiViews

AllowOverride All

Order allow,deny

allow from all

<directory></directory>
  • Aktifkan module rewrite (untuk mengaktifkan URL ramah Drupal), gunakan command:
    $ sudo a2enmod rewrite

    , sehingga akan muncul:

    Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.
  • Jalankan/restart web server apacheuntuk mengaktifkan perubahan yang sudah dilakukan dengan command:
    $ sudo /etc/init.d/apache2 restart

    , jika berhasil maka akan muncul:

Restarting web server apache2

...waiting                                                          [ok]
  • Rubah kepemilikan root direktory web serverdengan command:
    $ sudo chown -R [nama-user] /var/www

Maksud saya agar [nama-user] memiliki akses full terhadap root direktori web server, sehingga memudahkan pengelolaan web saat kita login menggunakan user [nama-user] nantinya.

Konfigurasi MySQL:

Untuk mengelola database MySQL saya menggunakan phpMyAdmin. Saya hanya perlu menambahkan user baru selain root untuk akses database nantinya.

1.Dari browser arahkan URL ke: http://localhost/phpmyadmin. Kemudian masukkan username root dan password.

2.Setelah login dihalaman phpMyAdmin, pilih tab Hak Akses. Kemudian tambahkan pengguna baru, beri hak atas akses database untuk host localhost.

Konfigurasi php.ini:

Saya hanya merubah pada bagian memory_limit = 16M pada file /etc/php5/apache2/php.ini menjadi memory_limit = 64M. Hal ini dibutuhkan saat kita menggunakan modul CCK pada Drupal 6 yang saya gunakan.

Berikut saya sertakan versi pdf untuk instal WordPress di Ubuntu Lokal (yang sedianya untuk demo di Lab Komputer), silahkan diunduh di sini (Konfigurasi Web Server dan Instalasi WordPress Lokal di Ubuntu).

_______________________________________

Sumber: http://fxekobudi.net/linux/instalasi-dan-konfigurasi-lamp-server-di-ubuntu-904-jaunty-jackalope/