Pagine

Linux - Appunti e tips su Centos 6

Aggiungere un utente amministratore di macchina in Centos 6


useradd cent
passwd cent


vi /etc/group
# line 11: add user name wheel:x:10:root,cent


vi /etc/pam.d/su



#%PAM-1.0
authsufficientpam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#authsufficientpam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
# uncomment the following line
authrequiredpam_wheel.so use_uid
authincludesystem-auth
accountsufficientpam_succeed_if.so uid = 0 use_uid quiet
accountincludesystem-auth
passwordincludesystem-auth
sessionincludesystem-auth
sessionoptionalpam_xauth.so


Per far arrivare le mail di root su cent รจ sufficiente



vi /etc/aliases


# last line: uncomment and change to a user
root: cent
# newaliases 




<------------------>




Disattivare Firewall:




/etc/rc.d/init.d/iptables stop 


chkconfig iptables off 


chkconfig ip6tables off 




<------------------>

Settare la rete


vi /etc/sysconfig/network-scripts/ifcfg-eth0




DEVICE=eth0
HWADDR=00:50:43:00:3B:AE
# change
ONBOOT=yes
# add lines as follows
BOOTPROTO=none
# this server's IP address
IPADDR=10.0.0.30
# subnet mask
NETMASK=255.255.255.0
TYPE=Ethernet
# default gateway
GATEWAY=10.0.0.1
# DNS server's IP address
DNS1=10.0.0.10
IPV6INIT=no
USERCTL=no


<------------------>


Disabilitare IPV6


echo "install ipv6 /bin/true" > /etc/modprobe.d/disable-ipv6.conf

<------------------>


Installare le patch:



yum -y install yum-plugin-fastestmirror 


yum -y update



<------------------>


Aggiungere repository:



wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt


rpm --import RPM-GPG-KEY.dag.txt 


Aggiungere repository


rm -f RPM-GPG-KEY.dag.txt 


vi /etc/yum.repos.d/rpmforge.repo


# creare nuova sezione


[rpmforge]


name=RPMforge RPM repository for Red Hat Enterprise Linux
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el6/en/$basearch/rpmforge/
gpgcheck=1
enabled=0


# quando si vogliono scaricare le patch da un repository particolare usare la seguente sintassi


yum --enablerepo=rpmforge install [package]



<------------------>

wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6

rpm --import RPM-GPG-KEY-EPEL-6 

rm -f RPM-GPG-KEY-EPEL-6 

vi /etc/yum.repos.d/epel.repo

# creare nuova sezione
[epel]
name=EPEL RPM Repository for Red Hat Enterprise Linux
baseurl=http://ftp.riken.jp/Linux/fedora/epel/6/$basearch/
gpgcheck=1
enabled=0

# when you use the repository, input yum command like follows

yum --enablerepo=epel install [package]

<------------------>

Disabilitare SeLinux (Security-Enhanced Linux) se non ne abbiamo bisogno

vi /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#enforcing - SELinux security policy is enforced.
#permissive - SELinux prints warnings instead of enforcing.
#disabled - SELinux is fully disabled.
SELINUX=disabled#cambiare
# SELINUXTYPE= type of policy in use. Possible values are:
#targeted - Only targeted network daemons are protected.
#strict - Full SELinux protection.
SELINUXTYPE=targeted


<------------------>

Installiamo Vim:

yum -y install vim-enhanced


Settiamo il programma di alias ( Apply to all users below. If you apply to a user, Write the same settings in '~/.bashrc' )

vi /etc/profile

# aggiungere all'ultima riga

source /etc/profile# applica i settaggi nuovi

Configuriamo vim. ( Apply to a user below. If you applly to all users, Write the same settings in '/etc/vimrc', some settings are applied by default though. )

vi ~/.vimrc

" use extended function of vim (no compatible with vi)
set nocompatible

" specify encoding
set encoding=euc-jp

" specify file encoding
set fileencodings=iso-2022-jp,sjis

" specify file formats
set fileformats=unix,dos

" take backup
" if not, specify [ set nobackup ]
set backup

" specify backup directory
set backupdir=~/backup

" take 50 search histories
set history=50

" ignore Case
set ignorecase

" distinct Capital if you mix it in search words
set smartcase

" highlights matched words
" if not, specify [ set nohlsearch ]
set hlsearch

" use incremental search 
" if not, specify [ set noincsearch ]
set incsearch

" show line number
" if not, specify [ set nonumber ]
set number

" Visualize break ( $ ) or tab ( ^I )
set list

" highlights parentheses
set showmatch

" show color display
" if not, specify [ syntax off ]
syntax on

" change colors for comments if it's set [ syntax on ]
highlight Comment ctermfg=LightCyan

" wrap lines
" if not, specify [ set nowrap ]
set wrap

<------------------------>

Settiamo Sudo



<------------------------>


Gestiamo cron:


yum -y install cronie-noanacron 

* there is time settings of Cron in /etc/cron.d/dailyjobs

Rimuoviamo anacron settings package

yum -y remove cronie-anacron