Suppose /dev/sdb is the newly added disc. The original volume group is vg_dvd01. The logical volume to be enlarged is lv_home.
# Use fdisk to change a partition to be added to ID 8e
fdisk /dev/sdb
# Make /dev/sdb1 a physical volume
pvcreate /dev/sdb1
# Add /dev/sdb1 to the volume group
vgextend -v vg_dvd01 /dev/sdb1
# Resize the target logical volume to use 100% free space of the volume group
lvresize -l +100%FREE /dev/vg_dvd01/lv_home
# Umount the file system first to speed up the resize operation
umount /home
# Do the resize
resize2fs /dev/vg_dvd01/lv_home
# Mount it back
mount /home
Tuesday, December 25, 2012
Create a few users on the just installed Linux
# Create the group first with group ID 1000
groupadd -g 1000 dvdgrp1
# Create the first user with user ID 1000
useradd -u 1000 -g dvdgrp1 user1
# Add other users
for i in user2 user3 user4 user5 user6 user7 user8 user9 user10
do
useradd -g dvdgrp1 $i
done
# Set initial password to the same as user name
for i in user1 user2 user3 user4 user5 user6 user7 user8 user9 user10
do
echo $i | passwd --stdin $i
done
groupadd -g 1000 dvdgrp1
# Create the first user with user ID 1000
useradd -u 1000 -g dvdgrp1 user1
# Add other users
for i in user2 user3 user4 user5 user6 user7 user8 user9 user10
do
useradd -g dvdgrp1 $i
done
# Set initial password to the same as user name
for i in user1 user2 user3 user4 user5 user6 user7 user8 user9 user10
do
echo $i | passwd --stdin $i
done
Enable Samba server in CentOS 6.3
- Install Samba
yum install samba samba-common - Edit Samba config file
vi /etc/samba/smb.conf - In the [global] section
security = user
passdb backend = tdbsam
# Set to follow symbolic links
follow symlinks = yes
wide links = yes
unix extensions = no - In the [homes] section
comment = Home Directories
browseable = no
writable = yes
valid users = %S
create mask = 0664
directory mask = 0775 - Enable Samba in run levels 2, 3, 4, 5
chkconfig --levels 2345 smb on - Start the just installed Samba
/etc/init.d/smb start - Add users with default password as user name
for i in user1 user2 user3 user4 user5
do
echo -e $i\\n$i | smbpasswd -a -s $i
done - Add these lines to /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT - Restart iptables
service iptables restart - Let SELinux enable Samba home dirs
setsebool -P samba_enable_home_dirs on
Monday, December 24, 2012
Sunday, December 23, 2012
Friday, December 21, 2012
Build and install tmux without root privilege
tmux is the new terminal multiplexer. It is used to replace the old screen.
mkdir ~/tools
cd tools
TOOLPATH=$PWD
tar zxf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=$TOOLPATH
make
make install
cd ..
tar zxf tmux-1.7.tar.gz
cd tmux-1.7
CPPFLAGS="-I$TOOLPATH/include" LDFLAGS="-L$TOOLPATH/lib" ./configure --prefix=$TOOLPATH
make
make install
cd ..
After tmux is installed to $TOOLPATH/bin, do not forget to add where $TOOLPATH/bin is to your .bashrc. For a good example of .tmux.conf, please check here http://blog.longwin.com.tw/2011/04/tmux-learn-screen-config-2011/. The link is https://github.com/tsung/config/blob/master/shell/tmux.conf.
mkdir ~/tools
cd tools
TOOLPATH=$PWD
tar zxf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=$TOOLPATH
make
make install
cd ..
tar zxf tmux-1.7.tar.gz
cd tmux-1.7
CPPFLAGS="-I$TOOLPATH/include" LDFLAGS="-L$TOOLPATH/lib" ./configure --prefix=$TOOLPATH
make
make install
cd ..
After tmux is installed to $TOOLPATH/bin, do not forget to add where $TOOLPATH/bin is to your .bashrc. For a good example of .tmux.conf, please check here http://blog.longwin.com.tw/2011/04/tmux-learn-screen-config-2011/. The link is https://github.com/tsung/config/blob/master/shell/tmux.conf.
Subscribe to:
Posts (Atom)