Friday, 24 January 2014

Set Bridge Ethernet in linux

|0 comments
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ifconfig br0 192.168.7.119 netmask 255.255.255.0 up
route add default gw 192.168.7.2 dev br0
ifconfig eth0 0.0.0.0 promisc up
ifconfig eth1 0.0.0.0 promisc up
brctl stp br0 off 

Ubuntu to Windows Domain via Active Directory

|0 comments
Attach Ubuntu to Windows Domain via Active Directory (+ sudo)
Posted by Jagdish Goswami
There may not be too many advantages to adding your Ubuntu machines to your Windows domain, but if you think of them this will allow you to work toward them.  It’s actually pretty easy to add a Linux box to Active Directory.  This is true because AD started out life as an LDAP server and it still retains its LDAP genes somewhere deep inside its withered exterior.
First thing you will want to do is add this utility to your Ubuntu machine:
sudo apt-get install likewise-open
It will allow you to authenticate against AD using Kerberos.  If you don’t know what that means it’s not important at this stage; it’s enough to understand that it’s a secure method for assuring identity between your client machine and your AD server.
I then added the machine to the domain.  Again this is a simple operation.  Before you do anything on the Ubuntu machine, hop into Active Directory and create a machine account in the name of the Ubuntu machine.  Then back on the Ubuntu machine it’s one line of code:
sudo domainjoin-cli join [domain.name] [username]
Easy enough.
Further I added a domain group to the local sudo group by adding these lines to the/etc/sudoers file:
# Active Directory group [groupname] given sudo privs
%[domain.name]\\[groupname] ALL=(ALL) ALL
If you don’t know how to edit a protected file like /etc/sudoers I recommend using Gedit:
gksudo gedit /etc/sudoers
Just add those two lines to the end of the file.  The first line is just a comment line and could say something different.  Replace those items in the square brackets with the appropriate information to your network.
For the group I created in Active Directory to grant these sudo privileges I included Domain Administrators and a couple of individuals who would likely be using the Ubuntu box and need sudo rights.  If you’d rather you could substitute a username for thegroupname in the edit above, but I think it’s better to use a security group in AD since you’re now attached to it.
Anyway, that’s about it.  Not too exciting but sure it’s useful for something.  Have fun with it.

(The same can be done with Macs or probably any Unix-like system as long as it can authenticate against an LDAP.  Of course for other systems the details will be, you know, different.)

Wednesday, 8 January 2014

CCNP Basics | IT HELP (CCNA,CCNP,MCSE,LINUX,VMWARE,CLOUD MGN)

|0 comments

Thursday, 18 July 2013

How to launch VMware Player VMs without GUI

|0 comments

How to launch VMware Player VMs without GUI

 

I assume that you have already created a VM using VMware Player, and so have *.vmx files ready somewhere. Now you want to start/stop the VM using vmrun. You don’t need root permission to use vmrun command.
First, download VMware VIX for Linux, and then install it on the VMware host as follows.
$ chmod 755 ./VMware-VIX-1.11.0-471780.x86_64
$ sudo ./VMware-VIX-1.11.0-471780.x86_64
To start VM:
$ vmrun -T player start /path/to/vm/my.vmx nogui
To reboot VM:
$ vmrun -T player reset /path/to/vm/my.vmx soft
To power off VM:
$ vmrun -T player stop /path/to/vm/my.vmx soft
VMware Player does not support VM snapshot operations. So you cannot take a snapshot of VMware Player VMs using vmrun. But if your VM was created using VMware Workstation or VMware Fusion, you can take a snapshot of a running VM as follows.
$ vmrun -T ws (or fusion) snapshot /path/to/vm/my.vmx my_snapshot

 

 

Wednesday, 3 July 2013

How do I backup MySQL in Linux?

|0 comments
How do I backup MySQL in Linux?



1. Copying from the mysql directory
By default, MySQL databases on servers that use Linux are stored in the following directory:
/var/lib/mysql/
If you shut down the mysqld service first, you can copy your databases to an example /backup directory using the following command:
cp –Rp /var/lib/mysql/*.* /backup

The –R switch for the cp command means recursive, which you want to use because each database is in a separate directory. The –p switch is for permissions, which will maintain the permissions of what is copied.
You generally want to shutdown the mysqld service before using the above method because if a database is copied while it is actively being used, the resulting backup will be corrupt and therefore worthless. If you are certain none of the databases are not being used at the time, you can use the above command.

2. The mysqldump command
The mysqldump command lets you back up both individual databases and all databases on a server without having to shutdown the mysqld service. Because of this ability to make backups while still keeping databases online, this method is preferred.

Individual databases
An example command that would let you back up a database named example to the directory /backup while logged in as root is as follows:
mysqldump example > /backup/example_backup.sql

Unless it is a small database, it is recommended that you then compress the resulting database backup in order to reduce the amount of time necessary to transfer the backup. The following command would compress the backup of the example database:
tar czvf /backup/example_backup.tar.gz /backup./example_backup.sql

All database
If you have numerous databases and backing all of them up individually would be too time consuming, the following command will backup all MySQL databases on your server to the /backup directory:
mysqldump -A > /backup/databases.sql(or --all-databases)
The –A switch (“-all-databases” performs the same function) will dump any and all databases on the server.

How to Reset CentOS root Password

|0 comments


How to Reset CentOS root Password

For those who are forgot their CentOS root password, please do not panic. There was the easy way to reset the root password for CentOS. Please follow this steps and you will be able to access your CentOS.
1. Reboot the CentOS machine
2. When booting up, press any key to go into the select menu.
3. The press ‘e’ to navigate to second grub.conf line (kernel)
4. Once again press ‘e’ to edit the line and you can select one step from these option :
  • option 1 : 1 (’1′) at the end of the line. OR
  • option 2: S (‘S’) a the end of the line OR
  • option 3: add ‘single’ to “ro root=LABEL=/ single”
5. After edit, hit “ENTER
6. Press ‘b’ to reboot
7. After reboot it will stop at ‘#’ command line.
8. At ‘#’ command line, type ‘passwd’ to create new password.
9. Reboot machine as usual
10 Finish

How to Enable CentOS Desktop

|0 comments


CentOS: Enable CentOS GNOME Desktop





Mostly the CentOS servers that I am using is run on CLI (Command-Line Interface) mode. But in some cases, I need to have a desktop to install some applications with GUI (Grapich User Interface) mode. In this case, I will use GNOME, the most popular user-friendly desktop for any UNIX based system.
Variable that I used as below:
OS: CentOS 6.2 64bit
Desktop environment: GNOME
1. Using yum, we will need to install X Windows System  as the based for GUI and rich input device capability:
$ yum groupinstall -y 'X Window System'
2. Only then we can install GNOME desktop environment on top of it:
$ yum groupinstall -y 'Desktop'
3. Since previously the server is running on CLI mode, we need to change some value to tell CentOS to boot up in the GUI mode. Open /etc/inittab via text editor and change following line:
id:3:initdefault:
To:
id:5:initdefault:
4. Reboot:
$ init 6
Note: You can switch from GUI to CLI mode manually by using following method:
GUI to CLI: Ctrl + Alt + F6
CLI to GUI: Ctrl + Alt + F1
If you want to start the desktop from CLI console (not SSH session), use following command:
$ startx
In some cases, when you login into the system via GUI, you will see some kind of weird boxes replacing the fonts. You can overcome this problem by installing fonts group via yum:
$ yum groupinstall -y fonts

How to Install Subversion (SVN) Server

|0 comments




Install Subversion (SVN) Server





Since programmers are already familiar with SVN instead of WebDAV, so I will need to setup a Subversion server  for them. By using PHP Designer 7 on Windows 7, they can connect SVN server viaTortoiseSVN plugin which available at http://tortoisesvn.tigris.org/.
Subversion is a full-featured version control system originally designed to be a better CVS. In layman term is it control the versioning of files being shared between users.In this case, I will use Subversion package which available in yum repo. Variables as below:
OS: CentOS 6.0 64bit
Server IP: 192.168.0.170
SVN directory for webproject1: /home/user1/webproject1
SVN user for webproject1: project1
SVN password for webproject1:  mypasswording1
SVN directory for webproject2: /home/user1/webproject2
SVN user for webproject2: project2
SVN password for webproject2:  mypasswording2
1. Firstly, we need to install SVN or subversion package via yum:
$ yum install subversion -y
2.  Create both project local directories:
$ mkdir -p /home/user1/webproject1
$ mkdir -p /home/user1/webproject2
3. Create both project SVN directories:
$ svnadmin create /home/user1/webproject1
$ svnadmin create /home/user1/webproject2
4. You should see following files and folders has been created under webproject1 directory (same goes towebproject2):
$ ls -1 /home/user1/webproject1/
conf
db
format
hooks
locks
README.txt
5. We need to configure the SVN service before we can use. Open the configuration file at /home/user1/webproject1/conf/svnserve.conf via text editor (repeat this step again for webproject2):
[general]

### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.

anon-access = read
auth-access = write

### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.

password-db = passwd

### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file. If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.

# authz-db = authz

### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.

realm = My First Repository
6. Then we create the user database to authorize which user we want to have read and write privileges for the repository. Using text editor, open the /home/user1/webproject1/conf/passwd and create the user:
project1:mypasswording1
7. SVN repository for webproject1 is completed. We need to do the same thing for webproject2. Open the /home/user1/webproject2/conf/passwd and create the user:
project2:mypasswording2
8. Lets start the SVN service as daemon:
$ svnserve -d
9. Lets check whether the SVN is running fine on default port 3690 (make sure your firewall has allowing this incoming port):
$ netstat -tulpn | grep svn
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 20412/svnserve
10. Lets say we already have web files for both projects located under /tmp directory in same server, so we might need to import the web files from local server to the SVN directory so SVN can start host the files. Before we start importing, we need to specify the default text editor that will be use by SVN:
$ export SVN_EDITOR=vim
$ cd /tmp/webproject1
$ svn import svn://project1@192.168.0.170/home/user1/webproject1
$ cd /tmp/webproject2
$ svn import svn://project2@192.168.0.170/home/user1/webproject2