Assuming you want to disable "squid" at boot, issue the command:
# update-rc.d -f squid remove
Saturday, June 29, 2013
Sunday, May 19, 2013
How to burn iso image to USB
Assuming that your iso image file is located in "/home/clemrasul/linux.iso" and your USB is in "/dev/sdb", the Linux command to burn the image is:
#dd if=/home/clemrasul/linux.iso of=/dev/sdb
This command comes built-in in Linux.
#dd if=/home/clemrasul/linux.iso of=/dev/sdb
This command comes built-in in Linux.
Thursday, August 9, 2012
How to execute a program at regular intervals in Ubuntu
Automatically executing a program at regular intervals in Ubuntu is undertaken using the Linux's/Unix's cron command. Here are the steps:
Step 1: Create the crontab file using an editor. For example:
# joe mycrontabfile.txt
Step 2: Enter the instructions for cron to follow. For example:
0 14 15,28 * * root /etc/firewall/firewall.sh
The instruction format is:
minute hour day month weekday user command
The values for minute is 0-59, hour is 0-23, day is 0-31, month is 0-12, weekday is 0-11. The asterisk character (*) is a wildcard and a comma (,) is a separator.
The above example means execute the program firewall.sh in the directory /etc/firewall with user root at 2pm on the 15th and 28th day of the month.
Step 3: Load the crontab file using the crontab command:
# crontab mycrontabfile.txt
Step 1: Create the crontab file using an editor. For example:
# joe mycrontabfile.txt
Step 2: Enter the instructions for cron to follow. For example:
0 14 15,28 * * root /etc/firewall/firewall.sh
The instruction format is:
minute hour day month weekday user command
The values for minute is 0-59, hour is 0-23, day is 0-31, month is 0-12, weekday is 0-11. The asterisk character (*) is a wildcard and a comma (,) is a separator.
The above example means execute the program firewall.sh in the directory /etc/firewall with user root at 2pm on the 15th and 28th day of the month.
Step 3: Load the crontab file using the crontab command:
# crontab mycrontabfile.txt
Autoexecute a program in Ubuntu at Boot
Assuming you have a script file named "firewall.sh", to automatically execute the file at boot time in Ubuntu, issue the following commands:
# mv firewall.sh /etc/init.d/
# chmod +x /etc/init.d/firewall.sh
# update-rc.d /etc/init.d/firewall.sh defaults
To remove the autoexecute command, type:
# update-rc.d -f /etc/init.d/firewall.sh remove
# mv firewall.sh /etc/init.d/
# chmod +x /etc/init.d/firewall.sh
# update-rc.d /etc/init.d/firewall.sh defaults
To remove the autoexecute command, type:
# update-rc.d -f /etc/init.d/firewall.sh remove
Friday, April 27, 2012
PostgreSQL Replication
The following setup were tested with PostgreSQL 9.1.1. As far as I know, the same setup can also be achieved starting from version 9.0. Version 9 added built-in replication to the PostgreSQL database. In the past PostgreSQL replication can be achieved by using third party software (e.g., Bucardo). Here are the steps:
On the master server assuming an IP address of 192.168.1.107:
Step 1
Edit the postgresql.conf file as follows:
listen_addresses = 'localhost, 192.168.1.107'
wal_level=hot_standby
max_wal_senders=1
wal_keep_segments=25
max_wal_senders=1
wal_keep_segments=25
Step 2
Assuming the slave server IP address of 192.168.1.104, edit the pg_hba.conf as follows:
host replication all 192.168.1.104/32 trust
Step 3
On psql CLI (as postgres user), issue the command:
SELECT pg_start_backup('backup');
Step 4
Copy the data directory of the master server and place it on the slave server. Use the command on psql CLI (as postgres user) to determine the physical location of the directory:
SHOW data_directory;On the Slave Server assuming an IP address of 192.168.1.104:
Step 5
Edit the postgresql.conf as follows:
hot_standby=on
hot_standby=on
Step 6
Create recovery.conf file as follows:
standby_mode='on'
primary_conninfo='host=192.168.1.107'
Step 7
Delete the postmaster.pid file
# rm postmaster.pid
Delete the postmaster.pid file
# rm postmaster.pid
On the Master Server:
Step 8
Issue the command on psql CLI as follows:
SELECT pg_stop_backup();
Simple ignore any warning messages.
Step 9
Restart PostgreSQL on the master server.
On the Slave Server:
Step 10
Start the PostgreSQL server.
Start the PostgreSQL server.
That's it. One last final note. Test your setup by issuing an INSERT or CREATE TABLE command on the master server. Check if the data are reflected on the slave server. If it is reflected, then you have just done database replication on PostgreSQL.
Friday, July 8, 2011
Printer Sharing on Ubuntu 10.10
Set the Linux Printer Server
The procedure below is tested on Linux Printer Server running Ubuntu 10.10 and CUPS 1.4.4. To setup the Linux Printer Server, make sure that the server can print into the connected printer. Once this is done, you can enable print sharing.
a) Click on System -> Administration -> Printing
b) Click on Add Printer and select your printer on the listed items
c) Afterwards, test if you can print from your server.
d) Enable print sharing by right-clicking on the printer and selecting "Properties" menu.
e) On the Policies, check the State "Enabled, Accepting jobs, and Shared"
f) Under access control select the button "Deny printing for everyone except these users:", then type in the list of users you want to share printer and click on the "Add" button. (e.g., bisita - this should be equivalent to the user logged in on the client machine)
g) Click on the button "Apply" then "OK"
h) On the "Printer Configuration" window, select the Server->Settings menu.
i) Check the item "Publish shared printers connected to this system", and "Allow printing from the Internet", then click on the OK button.
j) Restart the cups daemon by typing on the terminal:
# /etc/init.d/cups restart
On a Linux Client Machine
a) Click on System->Administration->Printing
b) Click on the Add button
c) Under the "Network Printer", select "Internet Printing Protocol"
d) Under the Host field, type in the IP address of the printer server (e.g., 192.168.1.10)
e) Under the Queue field, type in the name of the printer after the prefix /printers/ (e.g., /printers/hp900)
f) Click the button to "Verify" to confirm if your settings are good.
g) Then click the "Forward" button and select your printer on the listed items
h) Type in a description of your printer (e.g., hp900)
i) Finalized the setup by clicking the "Apply" and "OK" button
If everything goes smoothly, you should be able to print from your Linux client machine to your Linux Printer Server.
Windows Printing Thru CUPS
Windows can print to a Linux Print Server running cups. I assume that the CUPS server has been properly installed on a Linux server and it has been set as "sharing". The following procedure is how to set the printer under Windows (I have tested it under Windows XP Home Edition but my guess is it should work on most Windows variants):
a) Add Printer
b) Select "Connect Printer to the Internet"
c) Type in the address of CUPS server and the print queue (e.g., http://192.168.1.117:631/printers/hp900)
d) When prompted for the printer type, select "Generic", then select "MS Publisher Imagesetter" (This is usually a built in driver on Windows)
That's it.
Test your printing. You can monitor the status of your printing by going to your browser and typing the address (e.g., http://192.168.1.117:631) and clicking on the "Jobs" menu.
Erratum: The above procedure does not work with Windows 7 Starter Edition.
Printer Sharing via LPD
Print Sharing thru the legacy LPD is implemented via the cups-lpd daemon. This is activated through the xinetd superserver daemon. The procedure are as follows:
a) On the Linux Printer Server, download the xinetd superserver daemon xinetd by typing the command on the terminal:
# apt-get install xinetd
b) Configure the xinetd daemon by typing creating the a (e.g., printer ) under the directory /etc/xinetd.d/ and typing the following settings:
service printer
{
socket_type = stream
protocol = tcp
wait = no
user = bisita
group = sys
server = /usr/lib/cups/daemon/cups-lpd
server_args = -o document-format=application/octet/stream
}
c) Start the xinetd server by typing the command:
# /etc/init.d/xinetd start
d) Create the file hosts.lpd under the directory /etc and type in the name of allowed hosts (e.g., mydesktop ). Be sure the hostname mydesktop can be properly identified in the network. If not, include the name under the hosts file.
Printer Sharing under SMB protocol
The procedure below assumes that you have done the above procedure on Printer Sharing via LPD. The reason for this is that the Samba Server setup here for printing relies on the bsd as the printing mode.
a) Download and install the Samba software in the server.
# apt-get install samba
b) Configure the Samba server by editing the file /etc/samba/smb.conf given the pattern below:
[global]
workgroup = RASUL
netbios name = TIKBALANG
passdb backend = tdbsam
printcap name = cups
printing = bsd
load printers = yes
[printers]
comment = All Printers
browseable = yes
security = share
use client driver = yes
guest ok = yes
path = /var/spool/smbprint
printable = yes
public = yes
writable = yes
create mode = 0700
c) Create the directory /var/spool/smprint and change the ownership to 777 mode.
# mkdir /var/spool/smbprint
# chmod 777 /var/spool/smbprint
d) Restart the Samba server as follows:
#/etc/init.d/nmbd restart
#/etc/init.d/smbd restart
Afterwards, test if you can print from a Windows or Linux client machine.
The procedure below is tested on Linux Printer Server running Ubuntu 10.10 and CUPS 1.4.4. To setup the Linux Printer Server, make sure that the server can print into the connected printer. Once this is done, you can enable print sharing.
a) Click on System -> Administration -> Printing
b) Click on Add Printer and select your printer on the listed items
c) Afterwards, test if you can print from your server.
d) Enable print sharing by right-clicking on the printer and selecting "Properties" menu.
e) On the Policies, check the State "Enabled, Accepting jobs, and Shared"
f) Under access control select the button "Deny printing for everyone except these users:", then type in the list of users you want to share printer and click on the "Add" button. (e.g., bisita - this should be equivalent to the user logged in on the client machine)
g) Click on the button "Apply" then "OK"
h) On the "Printer Configuration" window, select the Server->Settings menu.
i) Check the item "Publish shared printers connected to this system", and "Allow printing from the Internet", then click on the OK button.
j) Restart the cups daemon by typing on the terminal:
# /etc/init.d/cups restart
On a Linux Client Machine
a) Click on System->Administration->Printing
b) Click on the Add button
c) Under the "Network Printer", select "Internet Printing Protocol"
d) Under the Host field, type in the IP address of the printer server (e.g., 192.168.1.10)
e) Under the Queue field, type in the name of the printer after the prefix /printers/ (e.g., /printers/hp900)
f) Click the button to "Verify" to confirm if your settings are good.
g) Then click the "Forward" button and select your printer on the listed items
h) Type in a description of your printer (e.g., hp900)
i) Finalized the setup by clicking the "Apply" and "OK" button
If everything goes smoothly, you should be able to print from your Linux client machine to your Linux Printer Server.
Windows Printing Thru CUPS
Windows can print to a Linux Print Server running cups. I assume that the CUPS server has been properly installed on a Linux server and it has been set as "sharing". The following procedure is how to set the printer under Windows (I have tested it under Windows XP Home Edition but my guess is it should work on most Windows variants):
a) Add Printer
b) Select "Connect Printer to the Internet"
c) Type in the address of CUPS server and the print queue (e.g., http://192.168.1.117:631/printers/hp900)
d) When prompted for the printer type, select "Generic", then select "MS Publisher Imagesetter" (This is usually a built in driver on Windows)
That's it.
Test your printing. You can monitor the status of your printing by going to your browser and typing the address (e.g., http://192.168.1.117:631) and clicking on the "Jobs" menu.
Erratum: The above procedure does not work with Windows 7 Starter Edition.
Printer Sharing via LPD
Print Sharing thru the legacy LPD is implemented via the cups-lpd daemon. This is activated through the xinetd superserver daemon. The procedure are as follows:
a) On the Linux Printer Server, download the xinetd superserver daemon xinetd by typing the command on the terminal:
# apt-get install xinetd
b) Configure the xinetd daemon by typing creating the a (e.g., printer ) under the directory /etc/xinetd.d/ and typing the following settings:
service printer
{
socket_type = stream
protocol = tcp
wait = no
user = bisita
group = sys
server = /usr/lib/cups/daemon/cups-lpd
server_args = -o document-format=application/octet/stream
}
c) Start the xinetd server by typing the command:
# /etc/init.d/xinetd start
d) Create the file hosts.lpd under the directory /etc and type in the name of allowed hosts (e.g., mydesktop ). Be sure the hostname mydesktop can be properly identified in the network. If not, include the name under the hosts file.
Printer Sharing under SMB protocol
The procedure below assumes that you have done the above procedure on Printer Sharing via LPD. The reason for this is that the Samba Server setup here for printing relies on the bsd as the printing mode.
a) Download and install the Samba software in the server.
# apt-get install samba
b) Configure the Samba server by editing the file /etc/samba/smb.conf given the pattern below:
[global]
workgroup = RASUL
netbios name = TIKBALANG
passdb backend = tdbsam
printcap name = cups
printing = bsd
load printers = yes
[printers]
comment = All Printers
browseable = yes
security = share
use client driver = yes
guest ok = yes
path = /var/spool/smbprint
printable = yes
public = yes
writable = yes
create mode = 0700
c) Create the directory /var/spool/smprint and change the ownership to 777 mode.
# mkdir /var/spool/smbprint
# chmod 777 /var/spool/smbprint
d) Restart the Samba server as follows:
#/etc/init.d/nmbd restart
#/etc/init.d/smbd restart
Afterwards, test if you can print from a Windows or Linux client machine.
Friday, July 1, 2011
Setting the Network Card to Static IP on Ubuntu
Edit the /etc/network/interaces file to:
auto eth1
iface eth1 inet static
address 10.10.10.2
netmask 255.255.255.0
gateway 10.10.10.1
dns-nameservers 10.10.10.250 10.10.10.251
Subscribe to:
Posts (Atom)