#准备工作 2009-11-13 下午15:49:36 ---------------------------------------------------------- #安装zlib # tar xvfz zlib-1.2.3.tar.gz # cd zlib-1.2.3 # ./configure --shared # make # make install ---------------------------------------------------------- #升级安装Openssl 不要卸载系统自带的Openssl,否则很多服务都起不来. # tar xzvf openssl-0.9.8k.tar.gz # cd openssl-0.9.8k # ./config shared #注意这里是用./config 会安装到/usr/local/ssl # make # make install #配置库文件搜索路径 # echo "/usr/local/ssl/lib" >> /etc/ld.so.conf # ldconfig -v ------------------------------------------------------------------------------------------- #升级安装Openssh # 首先卸载系统自带的Openssh # rpm -e --nodeps openssh-3.9p1-8.RHEL4.24 # 升级openssh # tar xzvf openssh-5.2p1.tar.gz # rm -rf /etc/ssh/* # cd openssh-5.2p1 # ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/ssl --with-zlib # make # make install ------------------------------------------------------------------------------------------- #安装cyrus-sasl # tar xzvf cyrus-sasl-2.1.23.tar.gz # cd cyrus-sasl-2.1.23 # ./configure --prefix=/usr/local/sasl2 --enable-login --with-openssl=/usr/local/ssl # make # make install #把原有的sasl库文件改名或删除,并将相关符号链接指向新安装SASL的库文件 # cd /usr/lib # mv libsasl2.so.2.0.19 libsasl2.so.2.0.19.OFF # mv libsasl2.so.2 libsasl2.so.2.OFF # rm -rf /usr/lib/sasl2/* # ln -s /usr/local/sasl2/lib/sasl2/* /usr/lib/sasl2/ # ln -s /usr/local/sasl2/lib/libsasl2.so.2.0.23 /usr/lib/libsasl2.so.2 # ln -s /usr/local/sasl2/lib/libsasl2.so /usr/lib/libsasl2.so #配置库文件搜索路径 # echo "/usr/local/sasl2/lib" >> /etc/ld.so.conf # echo "/usr/local/sasl2/lib/sasl2" >> /etc/ld.so.conf # ldconfig -v #创建运行时需要的目录并调试启动 # mkdir -pv /var/state/saslauthd #启动并测试验正 # /usr/local/sasl2/sbin/saslauthd -a shadow # /usr/local/sasl2/sbin/testsaslauthd -u root -p root的密码 0: OK "Success." ----------------------------------------------------------------------- #安装BerkeleyDB 不建议安装Berkeley DB 4.7.25 经测试,会出现莫名其妙的错误 # tar xzvf db-4.6.21.tar.gz # cd db-4.6.21/build_unix # ../dist/configure --prefix=/data/BerkeleyDB --sysconfdir=/etc # make # make install #配置库文件搜索路径 # echo "/data/BerkeleyDB/lib" >> /etc/ld.so.conf # ldconfig -v ----------------------------------------------------------------------- #安装openldap # tar xzvf openldap-stable-20090411.tgz # cd openldap-2.4.16 # env CPPFLAGS="-I/data/BerkeleyDB/include -I/usr/local/sasl2/include" LDFLAGS="-L/data/BerkeleyDB/lib -L/usr/local/sasl2/lib -L/usr/local/sasl2/lib/sasl2" ./configure --prefix=/usr/local/openldap --sysconfdir=/etc --enable-passwd --enable-wrappers --enable-spasswd --enable-crypt --enable-modules --enable-ldap --enable-accesslog # make depend # make # make test #这一步时间会很长 # make install # cp /usr/local/openldap/var/openldap-data/DB_CONFIG.example /usr/local/openldap/var/openldap-data/DB_CONFIG #配置库文件搜索路径 # echo "/usr/local/openldap/lib" >> /etc/ld.so.conf # ldconfig -v # chmod 700 /usr/local/openldap/var/openldap-data # mkdir -p /usr/local/openldap/var/accesslog ==============安装apache软件============================================================= ------------------------------------------------------------------------------------------ # tar zxvf httpd-2.2.11.tar.gz # cd httpd-2.2.11 # ./configure --prefix=/data/apache --enable-mods-shared=all --enable-so # make # make install # cp /data/apache/bin/apachectl /etc/init.d/httpd # chmod +x /etc/init.d/httpd # vi /etc/rc.d/rc.local #在rc.local上加入一行/data/apache/bin/apachectl –k start 系统启动时自动启动Apache服务 ------------------------------------------------------------------------------------------ # tar xzvf gettext-0.17.tar.gz # cd gettext-0.17 # ./configure --prefix=/usr/local/gettex # make # make install #配置库文件搜索路径 # echo "/usr/local/gettex/lib" >> /etc/ld.so.conf # ldconfig -v ------------------------------------------------------------------------------------------ #安装PHP # tar xzvf php-5.2.9.tar.gz # cd php-5.2.9 # ./configure --prefix=/data/php5 --with-config-file-path=/etc --with-apxs2=/data/apache/bin/apxs --with-zlib --enable-xml --enable-mbstring --enable-sockets --with-openssl=/usr/local/ssl --with-ldap=/usr/local/openldap --with-gettext=/usr/local/gettex # make # make install # cp php.ini-dist /etc/php.ini # vi /data/apache/conf/httpd.conf #查找AddType application/x-compress .Z AddType application/x-gzip .gz .tgz 在其下加入 --------------------------------------------------- AddType application/x-tar .tgz AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps AddType image/x-icon .ico --------------------------------------------------- 改DirectoryIndex 行,添加index.php 修改为DirectoryIndex index.php index.html index.html.var ------------------------------------------------------------------------------------------ #安装PhpLDAPAdmin # tar xzvf phpldapadmin-1.1.0.7.tar.gz -C /data/apache/htdocs/ # cd /data/apache/htdocs/phpldapadmin-1.1.0.7/config # cp config.php.example config.php # vi /data/apache/conf/httpd.conf # 加入以下内容: <VirtualHost *:8080> ServerAdmin [email protected] DocumentRoot "/data/apache/htdocs/phpldapadmin-1.1.0.7" </VirtualHost> ------------------------------------------------------------------------------------------------------------------------------------------------- #从和主的ldap安装完全一样,只是配置文件略有不同 配置文件位于/etc/openldap/sldap.conf #ldap配置文件见请分别参考sldap-master.conf和sldap-slave.conf # 启动ldap # /usr/local/openldap/libexec/slapd # cd /usr/local/openldap/bin/ # 将如下内容保存为.ldif文件 # vi replicator.ldif dn: cn=replicator,dc=mydomain,dc=com objectClass: simpleSecurityObject objectClass: organizationalRole cn: replicator description: LDAP replicator userPassword: woaiwojia #这里的replicator是用来同步主从之间数据的用户 #导入replicator用户到数据库 # /usr/local/openldap/bin/ldapadd -x -D 'cn=admin,dc=sun,dc=com' -W -f replicator.ldif ldap客户端配置(有三种方法,这里采取最简单的一种) # authconfig #选择Use LDAP, Use MD5 Password, Use Shadow Password, Use LDAP Authenticatio, Local authorization is sufficien #然后next,填入LDAP服务器的IP和Base DN #修改/etc/pam.d/system-auth 插入如下代码 session required pam_mkhomedir.so skel=/etc/skel umask=0077 # 添加用户:直接打开IE输入:http://ip:8080 输入slapd.conf中预先定义的用户名和密码登陆 ########################################---END---################################################################## ################################################################################################################### #ldap查询命令 #/usr/local/openldap/bin/ldapsearch -x -b 'dc=sun,dc=com' ldap的配置文件比较特别,和别的一般的包的名字,位置都不太一样。 我是这样理解,ldap有3个配置文件,他们各自有不同的用途。 /etc/openldap/slapd.conf 这是ldap的主要的配置文件 ldap还有另外两个配置文件,名字都是 ldap.conf ,比较容易搞错。 /etc/ldap.conf :是用来作为 LDAP's Name Service Switch (NSS) interfaces, /etc/openldap/ldap.conf :specifies defaults for various LDAP client programs #限制用户登录 # vi /etc/ldap.conf 过滤一个用户 pam_filter gidNumber=1000 过滤多个用户 pam_filter |(gidNumber=10)(gidNumber=501)(gidNumber=500) 注:这里过滤的组是允许登录的组 ----------------------------------------------------- ldap客户机,需要将 “ldap” 添加到 /etc/nsswitch.conf ---------------------- passwd: files ldap shadow: files ldap group: files ldap --------------------- 本人测试结果: file 在前 ldap在后就是 ldap失败的时候可以通过本地系统的用户登陆,相反file在后,ldap在前,就是ldap失败的话本地也无法登陆.
2010.1.13
安装成功版本 BerkeleyDB.4.6.21 与openldap .2.4.17 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/wang01ning/archive/2009/11/13/4809267.aspx