Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts
September 27, 2015
July 9, 2012
How to change the GRUB 2 Default Timeout and Boot Order - Ubuntu
GRUB 2 is the next generation of GNU GRUB, using version numbers 1.90 and above. GRUB 2 is a complete rewrite. The most important goal is to make GNU GRUB cleaner, safer, more robust, more portable and more powerful.
If you're already familiar with GRUB Legacy, you'll find that the GRUB 2 configuration file is similar in broad strokes, but it varies in many details. You should be aware of alternative means of configuring GRUB 2, as well.
To make any changes the way GRUB 2 works you need to edit the main GRUB 2 configuration file located in /etc/default/ folder, you can edit it by running the following command from terminal:
sudo gedit /etc/default/grub you should see the content very similar to this ....
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=7
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null
echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
Change default Timeout:
To change the default timeout option in GRUB 2, you just need to change the GRUB_TIMEOUT parameter. The value of this parameter is in sec, change this value as per your requirement.
Change the default boot option:
To change the default boot option in GRUB 2, you just need to change the GRUB_DEFAULT parameter. 0 is the first entry, so if you want Windows to be your default boot option which is, say at, 5th position in the grub menu, then you just need to change the GRUB_DEFAULT value to 4 and save the file and close it. Save the file after making all the required changes and from the terminal run the following command
sudo update-grub
Ubuntu - Sharing a Printer with Windows
Ubuntu - Sharing a Printer with Windows
It is usually best to use a native printing protocol. For Ubuntu, LPD and CUPS are native. Most versions of Windows support network printing to LPD servers, so sharing with LPD should be enough, but it requires users to configure their printers.
Native Windows environments can share printers using the Server Message Block (SMB) protocol. This allows Windows users to browse the Network Neighborhood and add any shared printers-very littlemanual configuration is required. For Ubuntu to share a printer with Windows users requires installing SAMBA, an open source SMB server.
On the print server:
1. Install SAMBA on the print server. This providesWindows SMB support:
1 sudo apt-get install samba
2. Create a directory for the print spool:
view sourceprint?
1 sudo mkdir /var/spool/samba/
3. Edit the SAMBA configuration file: /etc/samba/smb.conf.
4. Under the [global] section, change workgroup = to match yourWindows Workgroup. For example, my office workgroup is SLUGGO:
view sourceprint?
1 [global]
2 workgroup = SLUGGO
5. Under the [global] section is an area for printer configuration. Uncomment (remove the leading ;) the load printers = yes andCUPSprinting lines.
view sourceprint?
01 ########## Printing ##########
02 # If you want to automatically load your printer list rather
03 # than setting them up individually then you’ll need this
04 load printers = yes
05 # lpr(ng) printing. You may wish to override the location of the
06 # printcap file
07 ; printing = bsd
08 ; printcap name = /etc/printcap
09 # CUPS printing. See also the cupsaddsmb(8) manpage in the
10 # cupsys-client package.
11 printing = cups
12 printcap name = cups
6. Set the [printers] section to look like this:
01 [printers]
02 comment = All Printers
03 browseable = no
04 security = share
05 use client driver = yes
06 guest ok = yes
07 path = /var/spool/samba/
08 printable = yes
09 public = yes
10 writable = yes
11 create mode = 0700
This setting allows any Windows client to access the printers without a password.
7. (Optional) Under the [printers] section, set browseable = yes. This allows Windows systems to see the printers through the Network Neighborhood.
8. Restart the SAMBA server:
view sourceprint?
1 sudo /etc/init.d/samba restart
On the Windows client, you can add the printer as if it were a Windows printer. For example, if the server’s name is printer.home.com and the printer is Okidata, then the shared printer resource would be \\printer.home.com\Okidata.Windows clients will need to install their own print drivers.
It is usually best to use a native printing protocol. For Ubuntu, LPD and CUPS are native. Most versions of Windows support network printing to LPD servers, so sharing with LPD should be enough, but it requires users to configure their printers.
Native Windows environments can share printers using the Server Message Block (SMB) protocol. This allows Windows users to browse the Network Neighborhood and add any shared printers-very littlemanual configuration is required. For Ubuntu to share a printer with Windows users requires installing SAMBA, an open source SMB server.
On the print server:
1. Install SAMBA on the print server. This providesWindows SMB support:
1 sudo apt-get install samba
2. Create a directory for the print spool:
view sourceprint?
1 sudo mkdir /var/spool/samba/
3. Edit the SAMBA configuration file: /etc/samba/smb.conf.
4. Under the [global] section, change workgroup = to match yourWindows Workgroup. For example, my office workgroup is SLUGGO:
view sourceprint?
1 [global]
2 workgroup = SLUGGO
5. Under the [global] section is an area for printer configuration. Uncomment (remove the leading ;) the load printers = yes andCUPSprinting lines.
view sourceprint?
01 ########## Printing ##########
02 # If you want to automatically load your printer list rather
03 # than setting them up individually then you’ll need this
04 load printers = yes
05 # lpr(ng) printing. You may wish to override the location of the
06 # printcap file
07 ; printing = bsd
08 ; printcap name = /etc/printcap
09 # CUPS printing. See also the cupsaddsmb(8) manpage in the
10 # cupsys-client package.
11 printing = cups
12 printcap name = cups
6. Set the [printers] section to look like this:
01 [printers]
02 comment = All Printers
03 browseable = no
04 security = share
05 use client driver = yes
06 guest ok = yes
07 path = /var/spool/samba/
08 printable = yes
09 public = yes
10 writable = yes
11 create mode = 0700
This setting allows any Windows client to access the printers without a password.
7. (Optional) Under the [printers] section, set browseable = yes. This allows Windows systems to see the printers through the Network Neighborhood.
8. Restart the SAMBA server:
view sourceprint?
1 sudo /etc/init.d/samba restart
On the Windows client, you can add the printer as if it were a Windows printer. For example, if the server’s name is printer.home.com and the printer is Okidata, then the shared printer resource would be \\printer.home.com\Okidata.Windows clients will need to install their own print drivers.
Upgrading Drives in Ubuntu
When you upgrade your hard drive, you’ll want to make sure that you transfer over all of your personal files. This could be as simple as transferring the contents of /home from one system to another. But if you have installed any custom applications (very likely) or tuned any configurations, then you will probably need to transfer system files, too. Here’s an easy way of doing it:
1. Shut down the system, remove the old drive, and install the new drive. Do not leave the old drive in the system, since you do not want to accidentally reformat the wrong drive.
2. Install Ubuntu on the system (see Chapter 1). Be sure to use the same base install. Don’t bother customizing this new install—it is only needed for making the drive bootable.
3. Shut down the system and install the old hard drive as the second drive.
Do not boot from the old hard drive.
4. Start up the computer and boot from the new drive.
5. Log in when the computer has rebooted and open a terminal.
6. Nowfor the hard part—finding thedrive’sdevice handle for the olddrive. This is a two-step process. First, use mount to identify the current drive. It will be the one that is mounted. Second, use sudo lshw -class disk to find the unused drive that needs to be mounted. In this example, the current drive is /dev/sdb and the new drive is /dev/sdc.
view sourceprint?
01 $ mount
grep -e /dev/sd -e /dev/hd
02 /dev/sdb1 on / type ext3 (rw,relatime,errors=remount-ro)
03 $ sudo lshw -class disk
04 *-disk:0
05 description: ATA Disk
06 product: ST3500320AS
07 vendor: Seagate
08 physical id: 0
09 bus info: scsi@4:0.0.0
10 logical name: /dev/sdb
11 version: SD15
12 serial: 9QM52R9R
13 size: 465GiB (500GB)
14 capabilities: partitioned partitioned:dos
15 configuration: ansiversion=5 signature=00070904
16 *-disk:1
17 description: ATA Disk
18 product: ST31500341AS
19 vendor: Seagate
20 physical id: 1
21 bus info: scsi@5:0.0.0
22 logical name: /dev/sdc
23 version: CC1H
24 serial: 9VS2N2QN
25 size: 1397GiB (1500GB)
26 capabilities: partitioned partitioned:dos
27 configuration: ansiversion=5 signature=00052eee
7. Mount the old drive partition(s). The partitions will be enumerated. Since drive /dev/sdc is aworking drive, there should be /dev/sdc1, /dev/sdc2, etc. If you know the data partition, then you can mount it. Otherwise, you can blindly mount each of the partitions.
view sourceprint?
1 cd /dev
2 for i in sdc[0-9]* ; do
3 sudo mkdir /media/$i
4 sudo mount /dev/$i /media/$i
5 done
8. As root, copy over all of the old files to the new system. For example, if /dev/sdc1 was the old / partition, then copy the data from /media/sdc1/ to the new /.
view sourceprint?
1 $ cd /media/sdc1
2 $ ls
3 bin dev initrd lib mnt root sys var
4 boot etc initrd.img lost+found opt sbin tmp vmlinuz
5 cdrom home initrd.img.old media proc srv usr vmlinuz.old
6 $ sudo tar -cf - *
( cd / ; tar -xvf - )
9. Repeat Step 8 with each of the data partitions. Be sure to copy data to the correct directory. For example, if /dev/sdc2 was /home, then copy the contents to /home, not /.
10. Since the copy may have brought over a newer kernel, you will want to reset the boot loader:
view sourceprint?
1 sudo update-grub
11. Now that everything is copied, you can reboot the system immediately. You don’t want to use shutdown, since that can save desktop settings over your new settings. To force an immediate reboot, use the -f parameter:
view sourceprint?
1 sudo reboot -f
When the system comes back up, you should have all of your old files right where you left them, and a minimal amount of residue (undesirable files) that you did not originally want. This method is great for switching partition layouts, since it only copies files, but it should not be used to upgrade operating systems.
1. Shut down the system, remove the old drive, and install the new drive. Do not leave the old drive in the system, since you do not want to accidentally reformat the wrong drive.
2. Install Ubuntu on the system (see Chapter 1). Be sure to use the same base install. Don’t bother customizing this new install—it is only needed for making the drive bootable.
3. Shut down the system and install the old hard drive as the second drive.
Do not boot from the old hard drive.
4. Start up the computer and boot from the new drive.
5. Log in when the computer has rebooted and open a terminal.
6. Nowfor the hard part—finding thedrive’sdevice handle for the olddrive. This is a two-step process. First, use mount to identify the current drive. It will be the one that is mounted. Second, use sudo lshw -class disk to find the unused drive that needs to be mounted. In this example, the current drive is /dev/sdb and the new drive is /dev/sdc.
view sourceprint?
01 $ mount
grep -e /dev/sd -e /dev/hd
02 /dev/sdb1 on / type ext3 (rw,relatime,errors=remount-ro)
03 $ sudo lshw -class disk
04 *-disk:0
05 description: ATA Disk
06 product: ST3500320AS
07 vendor: Seagate
08 physical id: 0
09 bus info: scsi@4:0.0.0
10 logical name: /dev/sdb
11 version: SD15
12 serial: 9QM52R9R
13 size: 465GiB (500GB)
14 capabilities: partitioned partitioned:dos
15 configuration: ansiversion=5 signature=00070904
16 *-disk:1
17 description: ATA Disk
18 product: ST31500341AS
19 vendor: Seagate
20 physical id: 1
21 bus info: scsi@5:0.0.0
22 logical name: /dev/sdc
23 version: CC1H
24 serial: 9VS2N2QN
25 size: 1397GiB (1500GB)
26 capabilities: partitioned partitioned:dos
27 configuration: ansiversion=5 signature=00052eee
7. Mount the old drive partition(s). The partitions will be enumerated. Since drive /dev/sdc is aworking drive, there should be /dev/sdc1, /dev/sdc2, etc. If you know the data partition, then you can mount it. Otherwise, you can blindly mount each of the partitions.
view sourceprint?
1 cd /dev
2 for i in sdc[0-9]* ; do
3 sudo mkdir /media/$i
4 sudo mount /dev/$i /media/$i
5 done
8. As root, copy over all of the old files to the new system. For example, if /dev/sdc1 was the old / partition, then copy the data from /media/sdc1/ to the new /.
view sourceprint?
1 $ cd /media/sdc1
2 $ ls
3 bin dev initrd lib mnt root sys var
4 boot etc initrd.img lost+found opt sbin tmp vmlinuz
5 cdrom home initrd.img.old media proc srv usr vmlinuz.old
6 $ sudo tar -cf - *
( cd / ; tar -xvf - )
9. Repeat Step 8 with each of the data partitions. Be sure to copy data to the correct directory. For example, if /dev/sdc2 was /home, then copy the contents to /home, not /.
10. Since the copy may have brought over a newer kernel, you will want to reset the boot loader:
view sourceprint?
1 sudo update-grub
11. Now that everything is copied, you can reboot the system immediately. You don’t want to use shutdown, since that can save desktop settings over your new settings. To force an immediate reboot, use the -f parameter:
view sourceprint?
1 sudo reboot -f
When the system comes back up, you should have all of your old files right where you left them, and a minimal amount of residue (undesirable files) that you did not originally want. This method is great for switching partition layouts, since it only copies files, but it should not be used to upgrade operating systems.
June 17, 2012
How to Configure Ubuntu’s Built-In Firewall
How to Configure Ubuntu’s Built-In Firewall
Ubuntu includes its own firewall, known as ufw – short for “uncomplicated firewall.” Ufw is an easier-to-use frontend for the standard Linux iptables commands. You can even control ufw from a graphical interface.
Ubuntu’s firewall is designed as an easy way to perform basic firewall tasks without learning iptables. It doesn’t offer all the power of the standard iptables commands, but it’s less complex.
Terminal Usage
The firewall is disabled by default. To enable the firewall, run the following command from a terminal:
sudo ufw enable
You don’t necessarily have to enable the firewall first. You can add rules while the firewall is offline, and then enable it after you’re done configuring it.
Working With Rules
Let’s say you want to allow SSH traffic on port 22. To do so, you can run one of several commands:
sudo ufw allow 22 (Allows both TCP and UDP traffic – not ideal if UDP isn’t necessary.)sudo ufw allow 22/tcp (Allows only TCP traffic on this port.)sudo ufw allow ssh (Checks the /etc/services file on your system for the port that SSH requires and allows it. Many common services are listed in this file.)
Ufw assumes you want to set the rule for incoming traffic, but you can also specify a direction. For example, to block outgoing SSH traffic, run the following command:
sudo ufw reject out ssh
You can view the rules you’ve created with the following command:
sudo ufw status
To delete a rule, add the word delete before the rule. For example, to stop rejecting outgoing ssh traffic, run the following command:
sudo ufw delete reject out ssh
Ufw’s syntax allows for fairly complex rules. For example, this rule denies TCP traffic from the IP 12.34.56.78 to port 22 on the local system:
sudo ufw deny proto tcp from 12.34.56.78 to any port 22
To reset the firewall to its default state, run the following command:
sudo ufw reset
Application Profiles
Some applications requiring open ports come with ufw profiles to make this even easier. To see the application profiles available on your local system, run the following command:
sudo ufw app list
View information about a profile and its included rules with the following command:
sudo ufw app info Name
Allow an application profile with the allow command:
sudo ufw allow Name
More Information
Logging is disabled by default, but you can also enable logging to print firewall messages to the system log:
sudo ufw logging on
For more information, run the man ufw command to read ufw’s manual page.
GUFW Graphical Interface
GUFW is a graphical interface for ufw. Ubuntu doesn’t come with a graphical interface, but gufw is included in Ubuntu’s software repositories. You can install it with the following command:
sudo apt-get install gufw
GUFW appears in the Dash as an application named Firewall Configuration. Like ufw itself, GUFW provides a simple, easy-to-use interface. You can easily enable or disable the firewall, control the default policy for inbound or outbound traffic, and add rules.
The rules editor can be used to add simple rules or more complicated ones.
Remember, you can’t do everything with ufw – for more complicated firewall tasks, you’ll have to get your hands dirty with iptables.
May 25, 2012
Step By Step Ubuntu 9.04 (Jaunty) LAMP Server Setup
Step By Step Ubuntu 9.04 (Jaunty) LAMP Server Setup
In around 15 minutes, the time it takes to install Ubuntu Server Edition, you can have a LAMP (Linux, Apache, MySQL and PHP) server up and ready to go. This feature, exclusive to Ubuntu Server Edition, is available at the time of installation.The LAMP option means you don’t have to install and integrate each of the four separate LAMP components, a process which can take hours and requires someone who is skilled in the installation and configuration of the individual applications. Instead, you get increased security, reduced time-to-install, and reduced risk of misconfiguration, all of which results in a lower cost of ownership.New pre-configured installation options have been added to the Ubuntu Server. Mail Server, Open SSH Server,Samba File Server, Print Server, Tomcat Java Server,Virtual Machine Host and Database Server options join existing LAMP and DNS options for pre-configured installations, easing the deployment of common server configurations.
Ubuntu LAMP server Install the following Versions
In around 15 minutes, the time it takes to install Ubuntu Server Edition, you can have a LAMP (Linux, Apache, MySQL and PHP) server up and ready to go. This feature, exclusive to Ubuntu Server Edition, is available at the time of installation.The LAMP option means you don’t have to install and integrate each of the four separate LAMP components, a process which can take hours and requires someone who is skilled in the installation and configuration of the individual applications. Instead, you get increased security, reduced time-to-install, and reduced risk of misconfiguration, all of which results in a lower cost of ownership.New pre-configured installation options have been added to the Ubuntu Server. Mail Server, Open SSH Server,Samba File Server, Print Server, Tomcat Java Server,Virtual Machine Host and Database Server options join existing LAMP and DNS options for pre-configured installations, easing the deployment of common server configurations.
Ubuntu LAMP server Install the following Versions
Ubuntu 9.04 (Jaunty Jackalope)
Apache 2.2.11
Mysql 5.1.30
PHP 5.2.6-3
Apache 2.2.11
Mysql 5.1.30
PHP 5.2.6-3
First you need to download server version of Ubuntu version from here after that create a CD and start booting with the CD Once it starts booting you should see the following screen in this you need to select your language and press enter
Now you need to select “Install Ubuntu Server” and press enter
Select your language and press enter
Select your location and press enter
If you want to try to have your keyboard layout detected by pressing a series of keys you need to select yes option.If you want to choose from a list click no
Select Origin of keyboard and press enter
Select keyboard layout and press enter
Detecting hardware to find CD-ROM Drivers in progress
Loading additional components in progress
Detecting Network hardware in progress
Configures the network with DHCP if there is a DHCP server in your network
Enter your server Hostname
Clock setup is in progress
Starting up the partitioner in progress
You have to partition your hard disk in this example i have selected use entire disk option.If you want to do manually you can choose manual option and press enter.Make sure you have swap partition in place
Warning message about data lost on your hard disk
Write the changes to disk here you need to select yes and press enter
Creating ext3 file system in progress
Installing base system in progress
You need enter the Full name of the user you want to create for your server in this example i have created ruchi user select continue and press enter
Enter your user account name here
Entered the password for ruchi user select continue and press enter
Confirm password for ruchi user
If you choose weak password this will prompt similar to the following screen
If you want to configure encrypted private directory select yes and press enter
Configuring the package manager select continue and press enter
Configuring package mirror this will be related to your country option
Select how do you want to configure automatic update press enter
Now it will start Installing software and here you need to select the server options here i have selected as LAMP for our LAMP server installation.If you want to select each package separately select “Manual package selection” option (This is new in jaunty server)
At the time of software installation it will prompt for mysql server root password enter root password of your choice and select continue
Confirm mysql server root password and select continue
Software installation is in progress
Installing GRUB Boot loader in progress
Finishing installation in Progress
Installation complete message here you need to remove your CD select continue and press enter it will reboot your server
After rebooting you can see the following screen prompt for username
This will complete the Ubuntu Jaunty LAMP Server Installation and your server is ready for installing applications which supports apache,mysql and php.
One more new feature i really like was after logging in it shows you system stats like CPU,Memory,Disk,Swap,No.of processes,No.of users logged in and no.of security updates available
Configuring Static ip address in Ubuntu server
If you want to install vim editor use the following command
sudo apt-get install vim-full
Ubuntu installer has configured our system to get its network settings via DHCP, Now we will change that to a static IP address for this you need to edit
Edit /etc/network/interfaces and enter your ip address details (in this example setup I will use the IP address 172.19.0.10):
sudo vi /etc/network/interfaces
and enter the following save the file and exit (In vi, ESC, then ZZ to save and exit)
# The primary network interface
auto eth0
iface eth0 inet static
address 172.19.0.10
netmask 255.255.255.0
network 172.19.0.0
broadcast 172.19.0.255
gateway 172.19.0.1
iface eth0 inet static
address 172.19.0.10
netmask 255.255.255.0
network 172.19.0.0
broadcast 172.19.0.255
gateway 172.19.0.1
Now you need to restart your network services using the following command
sudo /etc/init.d/networking restart
You need to setup manually DNS servers in resolv.conf file when you are not using DHCP.
sudo vi /etc/resolv.conf
You need to add look something like this
search domain.com
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
Subscribe to:
Posts (Atom)
