yum install -y gcc gcc-c++ gcc4-c++ autoconf gd gd-devel libxml2 libxml2-devel zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel expat expat-devel sqlite sqlite-devel png-devel jpeg-devel libtool libjpeg* libpng* freetype-devel pam-devel
wget
tar -zxvf myget-0.1.2.tar.gz
cd myget-0.1.2
./configure
make;make install
cd ..
/usr/local/bin/mytget -n 10 -f mysql-5.1.31.tar.gz
tar -zxvf mysql-5.1.31.tar.gz
cd mysql-5.1.31
./configure --prefix=/usr/local/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase
make;make install
cd ..
groupadd mysql
useradd -g mysql mysql
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
sed -i 's/skip-federated/#skip-federated/g' /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
chmod +w /usr/local/mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql/.
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
chkconfig --level 345 mysql on
service mysql start
/usr/local/mysql/bin/mysqladmin -u root password root
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
service mysql stop
service mysql start
wget
tar -zxvf pam_mysql-0.7RC1.tar.gz
cd pam_mysql-0.7RC1
./configure --with-openssl --with-mysql=/usr/local/mysql
make;make install
echo "/lib/security" >> /etc/ld.so.conf
ldconfig
/usr/local/mysql/bin/mysql -u root -proot
create database if not exists `pam`;
USE `pam`;
SET FOREIGN_KEY_CHECKS=0;
/*数据表 `admin` 的表结构*/
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*数据表 `admin` 的数据*/
LOCK TABLES `admin` WRITE;
insert into `admin` values
(1,'admin','admin');
UNLOCK TABLES;
/*数据表 `user` 的表结构*/
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`active` int(10) DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*数据表 `user` 的数据*/
LOCK TABLES `user` WRITE;
insert into `user` values
(1,'test','test',1);
vi /etc/pam.d/pam
auth required /lib/security/pam_mysql.so user=root passwd=root host=localhost db=pam table=user usercolumn=name passwdcolumn=password where=active=1 sqllog=0 crypt=0
account required /lib/security/pam_mysql.so user=root passwd=root host=localhost db=pam table=user usercolumn=name passwdcolumn=password where=active=1 sqllog=0 crypt=0
testsaslauthd -u test -p test -s pam
阅读(2200) | 评论(0) | 转发(0) |