Posts Tagged ‘Linux’
This posts will explain how to make a SCSI BUS rescan from a Linux System when ass a SCSI disk with the sytem is powered on.
The two more tipical example should be :
- Add one or more disk on a phisical machien supporting HotPlug and configure it in a new disk array.
- Add one ore more virtual disk to a virtual machine.
If you want to have the new disk(s) immediately available to the virtual machine without rebooting it, you have to run the following command :
echo “- – -” > /sys/class/scsi_host/host0/scan
Hope this help
Bye
Riccardo
Print This Post
This post will explain hot-to configure a unique IP Address on multiple NICs (Phisical or Virtual) on Debian GNU/Linux (with a 2.6 kernel).
This post assume you have a 192.168.0.0/24 network and that you want to assign 192.168.0.10/24 to your system.
Read the rest of this entry »
Ethernet bonding refers to aggregate multiple ethernet channels together to form a single channel. This is primarily used for redundancy in ethernet paths or for load balancing. This page refers to ifenslave mode in particular to configure ethernet bonding on Linux systems, and so doesn’t limit itself to discussion of 802.3ad Trunk Aggregation.
I’ve used the following modes a lot of time under Debian or Ubuntu and on Open-E.
This post will explain how to configure a backup MX server for queuing mail for two (or more) domains if the primary mail server of those domains become unreachable.
I’ve tested this configuration for relaying mail to Microsoft Exchange, Postfix, QMail, Sendmail, Lotus Domino, Merak and other less common mail server without any kind of problems.
You could use Red Hat Enterprise Linux (RHEL) or CentOS without change an line of the following configuration, but with small adjustement you can use this how to to any linux distribution.
I’ve used Postfix as mail server, because for me it’s the best, and Amavisd-New, Clamd and SpamAssassin for checking Virus and Spam on relaying mail.
This post assume you have two queuing for two domains “yourdomain.com” and “yourdomain.net”.
This post assume that you have a primary mail server (MX with preference 10) for “yourdomain.com” with IP 111.111.111.111 and a primary mail server (MX with preference 10) for “yourdomain.com” with IP 111.222.222.222 and you want to use a server with IP 222.222.222.222 for queuing mail of both domains.
This post will show a backup script used to create copies for a server running Oracle 10.2, some application server like FourJS and JBoss and some custom application written in java.
The backup process is divided in some parts :
- Variable declaration and export
- Oracle export and compress
- Data folder export and compress
- Application Server export and compress
- Tape writing of all compress file
- Tape checking
- Mail logging
This post assume you have the following enviroments, if you have something different you should only change variable declaration and comment some lines to have this script works.
- Oracle SID : DB01
- Oracle main folder : /oracle/product/10.2/db_1
- Oracle user/password : system/system
- DATA main folder to backup : /data
- APPSERVER main Folder : /appsrv
- Main backup folder : /data/backup
- Tape device : /dev/st0
Read the rest of this entry »
This post will explain how to configure a relay server to put on a DMZ network for relay mail for two domains, and use two mail server on the internal network.
This configuration will be useful to not publish your SMTP server (Linux, Exchange, Lotus Domino or whatever you have) directly on internet, and keep it in your internal network, and publish a relay server for security purpose.
I’ve tested this configuration for relaying mail to Microsoft Exchange, Postfix, QMail, Sendmail, Lotus Domino, Merak and other less common mail server without any kind of problems.
You could use Red Hat Enterprise Linux (RHEL) or CentOS without change an line of the following configuration, but with small adjustement you can use this how to to any linux distribution.
I’ve used Postfix as mail server, because for me it’s the best, and Amavisd-New, Clamd and SpamAssassin for checking Virus and Spam on relaying mail.
This post assume you have two internal network 192.168.1.0/24 and 192.168.2.0/24 and you have a mail server for yourdomain.com on the 192.168.1 network and another mail server for yourdomain.net on 192.168.2 network.
In particular the yourdomain.com mail server have 192.168.1.4/24 and yourdomain.net mail server have 192.168.2.1/24.
This post will also explain how to configure a simple SMTP authentication based on sasl to authenticate external user directly on the relay server and permit them to send mail to any ther domain using it.
This post will explain a quick and dirt method to block Skype for some user, but avoid to block access to https urls not defined as FQDN.
This post assume that your client have non direct Internet access and must pass trough your Squid Proxy Server to have an external connection.
This Post assume your local network is 192.168.1.0/24
This post assume you want to give SKYPE access to IPs from 192.168.1.100 to 192.168.1.200 and you want to give internet access to all your network.
Obviously you MUST change the IPs based on your REAL network configuration.
In the following configuration, I’m going to create some ACL to define my networks, the skype connection method, skype connections destinations and create a sort of WhiteList that could fill in with some exceptions to avoid https connection problems.
To mount a Samba share when Linux system comes up after reboot edit the /etc/fstab file and put entry as follows for your Windows/Samba share:
//yourserver/share /mnt/samba smbfs username=yourname,password=yourpassword 0 0
For example, if you want to mount a share called //yourserver/docs then you need to write following entry in /etc/fstab file:
//yourserver/docs /mnt/samba smbfs username=yourname,password=yourpassword 0 0
Hope this help
Bye
Riccardo
Print This Post
This post assume you have just installed SLES on your server, and that the server in correctly configured to access internet.
This post also assume that you want to create a mail server for the following domain :
- yourdomain.com
- yourdomain.net
In this post we’re going to create a local mail server, that support the two domain above (but could be more than those) based on Postfix and Cyrus-Imap, with IMAP, IMAPS and SIEVE support, optionally you could add also Antivirus and AntiSpam using Amavisd-New with Clamav and SpamAssassin, and we also going to provide a webmail using squirrelmail.
This post assume you want to put this mail server on your DMZ with an ip address 192.168.100.1 and that you want to permit mail relay from your local network (192.168.1.0/24) and from authenticated user.
All the tasks above will be explained in the rest of the post.
This post will explain hot-to configure a unique IP Address on multiple NICs (Phisical or Virtual) on SuSE Linux Enterprise Server (9 or 10).
This post assume you have a 192.168.1.0/24 network and that you want to assign 192.168.1.1/24 to your system.
This post will explain hot-to configure a unique IP Address on multiple NICs (Phisical or Virtual) on RedHat Linux (or Fedora).
This post assume you have a 192.168.1.0/24 network and that you want to assign 192.168.1.1/24 to your system.
This post will explain hot-to configure multiple IP Address on ONE nic (Phisical or Virtual) on RedHat Linux (or Fedora).
This post assume you have a 192.168.1.0/24 network and that you want to assign 192.168.1.1/24 and 192.168.1.2/24 to your system.
The following is a quick and dirt guide on how to use a mailbox with the “.” character with Cyrus Imap.
add the following line to your imapd.conf
unixhierarchysep: 1
login to your cyrus imap server and run the following command to create a new mailbox
cm user/your.name
setacl user/your.name cyrus lrsiwpcda
When the UNIX hierarchy convention is used, the “.” character MAY be used in mailbox names, including user names. In order to mantain backwards compatibility with the internal namespace, all “.” character will be translated in a benign character (at this time “^”) before any data is written to disk. For example, if user “your.name” had a personal mailbox “customer.support” , it would be stored as “user.your^name.customer^support” in the internal namespace.
If you use it, it’s very important that you remember this phenomenon if/when reverting back to the netnews hierarchy convention.
Hope this help
Bye
Riccardo
Print This Post
As you have noticed during the Ubuntu installation there was no question about the root password, as you might have been used to see during other Linux distribution installation process.
This is why the root account is inactive and can’t be used (no password configured) until we will setup a proper password for it.
To do this, we simply need to run:
sudo passwd root
This will ask for a new root password and once you confirm it, you can start using the root account to login by using :
su -
when you’re logged in as normal user.
In case you will want to disable back the root account, just lock the root account by running:
sudo passwd -l root
Hope this help
Bye
Riccardo
With the following command you could configure a proxy server (http and/or ftp) and use it for your current bash session or for apt.
This configuration will be lost when you close your shell.
export http_proxy=’http://user:password@proxy-server:port’
export ftp_proxy=’http://user:password@proxy-server:port’
Hope this help
Bye
Riccardo
When using Oracle 10g Release 2, a call to “dbstart" might result (perhaps every time) in the following error message:
Failed to auto-start Oracle Net Listener using /ade/vikrkuma_new/oracle/bin/tnslsnr
This is due to an internal path in the dbstart script.
To correct this, edit the “$ORACLE_HOME/bin/dbstart” script and replace the following line :
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
With this:
ORACLE_HOME_LISTNER=$ORACLE_HOME
The dbstart script shold now start the listener as expected.
Automating Shutdown and Startup (10.2)
Automating Startup and Shutdown (10.1)
Automating Database Startup and Shutdown (9.2)
Hope this help
Bye
Riccardo
Aliases in Linux provide shortcuts that can save you typing, let you build your own powerful commands, and make your command line life easier.
Background
I’ve found it very helpful to create aliases to make my command line life faster and. For instance, instead of always typing
ls -lah
to get a directory listing (ls), with ouptut in a list (-l) with show all files (-a) in a human readable output (-h), I’ve created an alias so I only have to type this: “l” (That’s the lower case letter “L”.)
Using aliases like this you can create anything from simple shortcuts like this to powerful custom commands.
Creating aliases is very easy. You can either enter them at the command line as you’re working, or more likely, you’ll put them in one of your startup files, like your .bashrc file, so they will be available every time you log in.
I created the l alias above by entering the following command into my .bashrc file:
alias l=”ls -lah”
As you can see, the syntax is very easy:
1. Start with the alias command
2. Then type the name of the alias you want to create
3. Then an = sign, with no spaces on either side of the =
4. Then type the command (or commands) you want your alias to execute when it is run. This can be a simple command, or can be a powerful combination of commands.
Sample aliases
To get you going, here is a list of sample aliases I use all the time. I’ve pretty much just copied them here from my .bashrc file:
alias l=”ls -lah”
alias lm=”ls -lah | more”
alias htmldir=”cd /var/www/html”
alias logsdir=”cd /var/log”
alias showfw=”iptables -Lnv”
alias dropfw=”iptables -F”
As you can see, you can get as creative as you want, and pipe commands together to do just about anything.
Because the Linux shell is very programmable and because the output of commands is very consistent and reliable, you can create your own aliases to do just about anything.
Hope this help
Bye
Riccardo
The following is a very simple init script for Oracle on Red Hat Enterprise Linux.
I’m using it successfully in RHEL 5.2 but you can use it on other systems, only double check the various path.
#!/bin/sh
#
# ORACLE Control Script
# chkconfig: 3 80 20
#
# Description: Here is a little startup/shutdown script for Oracle 10g on RedHat systems
#
# Author : Riccardo Riva
#
# Source LSB function library.
[ -f /lib/lsb/init-functions ] && . /lib/lsb/init-functions
#Assuming have Oracle installed on :
# /oracle/product/10.2.0/db1
ORACLE_HOME=/oracle/product/10.2.0/db_1
#Assuming have “oracle” user
ORACLE_OWNER=oracle
# Edit this with your DB instance name
ORACLE_DB=DB_INSTANCE_NAME
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo “Oracle startup: cannot start”
exit
fi
case “$1″ in
’start’)
# Start the Oracle databases:
su – $ORACLE_OWNER -c “$ORACLE_HOME/bin/lsnrctl start”
su – $ORACLE_OWNER -c $ORACLE_HOME/bin/dbstart
;;
’stop’)
# Stop the Oracle databases:
su – $ORACLE_OWNER -c $ORACLE_HOME/bin/dbshut
su – $ORACLE_OWNER -c “$ORACLE_HOME/bin/lsnrctl stop”
;;
’status’)
if su -l $ORACLE_OWNER -c “${ORACLE_HOME}/bin/tnsping ${ORACLE_DB} >/dev/null 2>&1″
then
exit 0
else
exit 1
fi
;;
esac
Create this script and put it in your /etc/init.d/ directory
Make this script excutable
Use “chkconfig” to set the startup or the shutdown for this script in the desired runlevels.
Hope this help avoid wasting time
Bye
Riccardo
The following is a simple command to change the word “cat” with the word “dog” in all *.txt files in your working directory.
You could use or customize this command in all way to adapt it to your need.
perl -pi -e ’s/cat/dog/’ *.txt
Hope this help
Bye
Riccardo
Recover MySQL database root password
Sometimes you couls have to recover MySQL database server password.
You could do it follow these easy steps :
1: Stop the MySQL server process.
/etc/init.d/mysql stop
2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password
mysqld_safe –skip-grant-tables &
3: Connect to mysql server as the root user
mysql -u root
4: Setup new root password
mysql> use mysql;
mysql> update user set password=PASSWORD(”NEW-ROOT-PASSWORD“) where User=’root’;
mysql> flush privileges;
mysql> quit
5: Exit and restart MySQL server
/etc/init.d/mysql stop
6: Start MySQL server and test it
/etc/init.d/mysql start
mysql -u root -p
Hope this help
Bye
Riccardo























