Linux安装手记_第1页
Linux安装手记_第2页
Linux安装手记_第3页
Linux安装手记_第4页
Linux安装手记_第5页
已阅读5页,还剩48页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Linux安装手记1、 系统安装选择安装启动内核加载检测并加载-通常不需要检测选择检测则进入如下界面:选择跳过则进入如下界面点击下一步进入语言选择界面:(默认选择英语)点击下一步进入键盘选择(默认美式英语)选择设备:选择基础存储设备进入下一步,设定主机名点击下一步进入时区选择选择安装类型自定义安装此时设置磁盘分区/swap 设置为内存大小的2倍,并且文件系统类型选择为swap/设置为50G 该目录为系统文件目录,不用太大/data 剩下全部文件一直下一步,进入安装界面选择基本服务器等待系统安装系统安装完成2、 安装完成后配置网络连接vi /etc/sysconfig/network-scrip

2、ts/ifcfg-eth0对应文件内容DEVICE=eth0BOOTPROTO=noneIPADDR=01NETMASK=GATEWAY=ONBOOT=yesHWADDR=00:30:18:AE:3D:4ETYPE=EthernetUSERCTL=noIPV6INIT=noPEERDNS=yes配置完成后重启网卡 service network restart配置DNSvi /etc/resolv.confsearch localdominnameserver nameserver 验证是否网络正

3、常Ping 查看系统时间date设置系统时间date -set=“07/07/06 10:19" (月/日/年 时:分:秒)系统时间和硬件时间同步hwclock -systohc 或者 clock systohc查看硬件时间hwclock -show至此,LINUX基本系统安装完毕。接下来就是软件安装3、 重新安装yum一删除 RHEL 自带的 yumrpm -aq|grep yum|xargs rpm -e nodeps安装:使用Centos的YUM源rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpmrpm -ivh yum-meta

4、data-parser-1.1.2-14.1.el6.x86_64.rpmrpm -ivh yum-3.2.27-14.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpmrpm -ivh yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm下载配置文件wget -O /etc/yum.repos.d/CentOS-Base.repo修改配置文件:mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/Cen

5、tOS-Base.repo.bakvi /etc/yum.repos.d/CentOS-Base.repo 输入以下内容: basename=CentOS-6 - Base - baseurl=#mirrorlist=/?release=6&arch=$basearch&repo=osgpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-6#released updates updatesname=CentOS-6 - Updates - bas

6、eurl=#mirrorlist=/?release=6&arch=$basearch&repo=updatesgpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be usefulextrasname=CentOS-6 - Extras - baseurl=#mirrorlist=/?release=6&arch=$ba

7、search&repo=extrasgpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packagescentosplusname=CentOS-6 - Plus - baseurl=#mirrorlist=/?release=6&arch=$basearch&repo=centosplusgpgcheck=1ena

8、bled=0gpgkey=/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Userscontribname=CentOS-6 - Contrib - baseurl=#mirrorlist=/?release=6&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=/centos/RPM-GPG-KEY-CentO

9、S-6保存并退出执行Yum 更新yum update一路y下去。4、 安装依赖包依赖包根据应用软件不同而不同。yum -y install gcc gcc-c+ bison patch unzip mlocate flex wget automake autoconf gd cpp gettext readline-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-d

10、evel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel libidn libidn-devel openldap openldap-devel openldap-clients openldap-servers nss_ldap expat-devel libtool libtool-ltdl-devel openssl*其中 gcc gcc-c+ 是c,c+语言编译器。是系统运行的关键。5、 安装MYSQL1) mysql版本<5.5cd /usr/local/srct

11、ar -zxf mysql-5.1.45.tar.gzcd mysql-5.1.45./configure -prefix=/usr/local/mysql -enable-assembler -enable-thread-safe-client -with-extra-charsets=all -with-big-tables -with-readline -with-ssl -with-embedded-server -enable-local-infile -with-plugins=partition,innodb_plugin,myisam,myisammrgmake &&a

12、mp; make installgroupadd mysql -g 27useradd mysql -u 27 -g 27 -c "MySQL Server" -d /var/lib/mysql Mcp /usr/local/mysql/share/mysql/my-f /etc/f/usr/local/mysql/bin/mysql_install_db -user=mysqlchown -R mysql /usr/local/mysql/varchgrp -R mysql /usr/local/mysql/.cp /usr/local/mysql/share/mysql

13、/mysql.server /etc/init.d/mysqlchmod u+x /etc/init.d/mysqlchkconfig -level 345 mysql onln -s /usr/local/mysql/lib/mysql /usr/lib/mysqlln -s /usr/local/mysql/include/mysql /usr/include/mysqlln -s /usr/local/mysql/bin/mysql_config /usr/bin/mysql_configservice mysql start/usr/local/mysql/bin/mysqladmin

14、 -u root password rootservice mysql restartservice mysql stop2) 如果mysql版本>=5.5,则必须使用cmake编译l 下载并安装cmakewget /files/v2.8/cmake-2.8.7.tar.gztar -zxf cmake-2.8.7.tar.gzcd cmake-2.8.7./configuremake && make installl 建立所需目录,并配置相应权限groupadd mysqluseradd -g mysql mysqlmkdir /u

15、sr/local/mysqlmkdir -p /data/mysql/datamkdir -p /data/mysql/logmkdir -p /data/mysql/relaychown -R mysql.mysql /data/mysqlmkdir /etc/mysqlchown mysql.mysql /usr/local/mysqlchown mysql.mysql /etc/mysqlchmod 755 /etc/mysqlchmod 755 /data/mysqlchmod 755 /usr/local/mysqll 开始安装Mysql5.5tar -zxf mysql-5.5.1

16、4.tar.gz cd mysql-5.5.14cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql/data/ -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_R

17、EADLINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_DEBUG=0 -DENABLED_LOCAL_INFILE=1 -DSYSCONFDIR=/etc/mysqlmake && make installl 源代码配置说明-DCMAKE_INSTALL_PREFIX= 数据库程序安装路径;-DMYSQL_DATADIR= 数据库文件存放路径-DMYSQL_UNIX_ADDR= 默认位置是/tmp/mysql.sock-DDEFAULT_CHARSET= 默认数据库编码-DDEFAULT_COLLATION= 默认数据库整理编码-DWITH_EXT

18、RA_CHARSETS= 扩展支持编码(all | utf8,gbk,gb2312 | none)-DWITH_MYISAM_STORAGE_ENGINE= MYISAM引擎支持(1|0)-DWITH_INNOBASE_STORAGE_ENGINE= innoDB引擎支持(1|0)-DWITH_MEMORY_STORAGE_ENGINE= MEMORY引擎支持(1|0)-DSYSCONFDIR=/etc f存放目录l 安装初始化数据库/usr/local/mysql/scripts/mysql_install_db -user=mysql -basedir=/usr/local/mysql -

19、datadir=/data/mysql/data &l 设置配置文件vi /etc/mysql/f 修改为mysqlsocket=/data/mysql/mysql.sockmysqlddatadir=/data/mysql/datasocket=/data/mysql/mysql.sockclientsocket=/data/mysql/mysql.sockmysqld_safelog-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pidl 初始化管理员密码cp /usr/local/mysql/support-fi

20、les/mysql.server /etc/init.d/mysqlservice mysql start/usr/local/mysql/bin/mysqladmin -u root password '123456'l 设置开机启动chmod +x /etc/init.d/mysqlchkconfig -add mysqlchkconfig mysql on/查看开机启动配置结果chkconfig -list | grep mysql显示如下:mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:offl 错误及解决“server PID file

21、 could not be found!”遇到以上错误则kill所有相关进程ps aux |grep mysq*kill 99999999pid找不到就新建ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)以上错误为数据库没有启动Service mysql start 即可重启mysql服务无效则可尝试Service mysql stop然后删除/data/mysql/mysql.sockService mysql startl 设置动态

22、链接库echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.confecho "/usr/local/lib" >>/etc/ld.so.confldconfigln -s /usr/local/mysql/lib/mysql /usr/lib/mysqlln -s /usr/local/mysql/include/mysql /usr/include/mysqlln -s /usr/local/mysql/mysql_config /usr/bin/mysql_config6、 安装 a

23、pachel 编译安装Apachecd /usr/local/srctar -zxf httpd-2.2.22.tar.gzcd httpd-2.2.22./configure -prefix=/usr/local/apache -enable-headers -enable-mime-magic -enable-proxy -enable-rewrite -enable-ssl -enable-suexec -disable-userdir -with-included-apr -with-mpm=prefork -with-ssl=/usr -with-suexec-caller=nobo

24、dy -with-suexec-docroot=/ -with-suexec-gidmin=100 -with-suexec-logfile=/usr/local/apache/logs/suexec_log -with-suexec-uidmin=100 -with-suexec-userdir=public_htmlmakemake install/mkdir /usr/local/apache/domlogsl 查看当前httpd默认加载模块/usr/local/apache/bin/httpd -ll 加入启动项cp /usr/local/apache/bin/apachectl /e

25、tc/init.d/httpdl 配置apache配置参数文件httpd.conf,位于/usr/local/apache/conf/目录cd /usr/local/apache/conf/mv httpd.conf httpd.conf.bakmkdir vhostsvi httpd.conf输入以下内容:PidFile logs/httpd.pidLockFile logs/accept.lockServerRoot "/usr/local/apache"Listen :81User nobodyGroup nobodyServerAdmin server

26、ServerName Timeout 300KeepAlive OffMaxKeepAliveRequests 100KeepAliveTimeout 5UseCanonicalName OffAccessFileName .htaccessTraceEnable OffServerTokens ProductOnlyFileETag NoneServerSignature OffHostnameLookups Off# LoadModule perl_module modules/mod_perl.soLoadModule php5_module modules/libphp5.soLoad

27、Module rpaf_module modules/mod_rpaf-2.0.so#LoadModule rewrite_module modules/mod_rewrite.so#Mod_rpaf settingsRPAFenable OnRPAFproxy_ips 41 your_ipsRPAFsethostname OnRPAFheader X-Forwarded-ForDocumentRoot "/usr/local/apache/htdocs"<Directory "/"> Options

28、 ExecCGI FollowSymLinks Includes IncludesNOEXEC -Indexes -MultiViews SymLinksIfOwnerMatch Order allow,deny Allow from all AllowOverride All</Directory><Directory "/usr/local/apache/htdocs"> Options Includes -Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from a

29、ll</Directory>DefaultType text/plainRewriteEngine onAddType text/html .shtmlAddHandler cgi-script .cgi .pl .plx .ppl .perlAddHandler server-parsed .shtml<IfModule mime_module> TypesConfig conf/mime.types AddType application/perl .pl .plx .ppl .perl AddType application/x-img .img AddType

30、application/x-httpd-php .php .php3 .php4 .php5 .php6 AddType application/x-httpd-php-source .phps AddType application/cgi .cgi AddType text/x-sql .sql AddType text/x-log .log AddType text/x-config .cnf conf AddType text/x-registry .reg AddType application/x-compress .Z AddType application/x-gzip .gz

31、 .tgz AddType text/html .shtml AddType application/x-tar .tgz AddType application/rar .rar AddType application/x-compressed .rar AddType application/x-rar .rar AddType application/x-rar-compressed .rar AddType text/vnd.wap.wml .wml AddType image/vnd.wap.wbmp .wbmp AddType text/vnd.wap.wmlscript .wml

32、s AddType application/vnd.wap.wmlc .wmlc AddType application/vnd.wap.wmlscriptc .wmlsc</IfModule><IfModule dir_module> DirectoryIndex index.html index.htm index.shtml index.php index.perl index.pl index.cgi</IfModule><Files "error_log$"> Order allow,deny Deny from a

33、ll Satisfy All</Files><FilesMatch ".ht"> Order allow,deny Deny from all Satisfy All</FilesMatch>ErrorLog "logs/error_log"LogLevel warn<IfModule log_config_module> LogFormat "%h %l %u %t "%r" %>s %b "%Refereri" "%User-Agenti

34、"" combined LogFormat "%h %l %u %t "%r" %>s %b" common <IfModule logio_module> LogFormat "%h %l %u %t "%r" %>s %b "%Refereri" "%User-Agenti" %I %O" combinedio </IfModule> CustomLog "logs/access_log" com

35、mon</IfModule><IfModule alias_module> ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"</IfModule><Directory "/usr/local/apache/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all</Directory><IfModule mpm_prefork_module>

36、StartServers 3 MinSpareServers 3 MaxSpareServers 5 MaxClients 150 MaxRequestsPerChild 1024</IfModule><IfModule mod_headers.c><FilesMatch ".(html|htm|shtml)$">Header set Cache-Control "max-age=3600, must-revalidate"</FilesMatch></IfModule>ReadmeName R

37、EADME.htmlHeaderName HEADER.htmlIndexIgnore .?* * *# HEADER* README* RCS CVS *,v *,tInclude conf/extra/httpd-languages.conf<Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from </Location>ExtendedStatus On<Location /server-info> SetHa

38、ndler server-info Order deny,allow Deny from all Allow from </Location><IfModule ssl_module>Listen :443AddType application/x-x509-ca-cert .crtAddType application/x-pkcs7-crl .crlSSLCipherSuite ALL:!ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXPSSLPassPhraseDialog builtinSSLSessionCac

39、he dbm:/usr/local/apache/logs/ssl_scacheSSLSessionCacheTimeout 300SSLMutex file:/usr/local/apache/logs/ssl_mutexSSLRandomSeed startup builtinSSLRandomSeed connect builtin</IfModule>#VhostsNameVirtualHost :81NameVirtualHost *Include conf/vhosts/*.cnf7、 编译安装PHPa) 编译安装相关支持库i. Libiconv 字符

40、集转换cd /usr/local/srctar -zxf libiconv-1.14.tar.gzcd libiconv-1.14/./configuremakemake installii. Libmcrypt 加密扩展cd /usr/local/srctar -zxf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8/./configuremakemake install/sbin/ldconfigcd libltdl/./configure -enable-ltdl-installmakemake installiii. Mhash mhash函数库cd

41、/usr/local/srctar -zxf mhash-.tar.gzcd mhash-/./configuremakemake installiv. 连接文件ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.laln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.soln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4ln -s /usr/local/lib/libmcrypt.so.4.

42、4.8 /usr/lib/libmcrypt.so.4.4.8ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.aln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.laln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.soln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhas

43、h.so.2.0.1b) 安装PHPcd /usr/local/srctar -zxf php-5.3.10.tar.gzpatch -d php-5.3.10 -p1 < php5-mail-header.patchcd php-5.3.10./configure -prefix=/usr/local -with-config-file-path=/etc -with-apxs2=/usr/local/apache/bin/apxs -enable-bcmath -enable-calendar -enable-exif -enable-ftp -enable-gd-native-tt

44、f -enable-libxml -enable-magic-quotes -enable-mbstring -enable-pdo=shared -enable-soap -enable-sockets -enable-zip -with-bz2 -with-curl -with-curlwrappers -with-freetype-dir -with-gd -with-gettext -with-jpeg-dir -with-kerberos -with-libxml-dir=/usr -with-mcrypt=/usr -with-mhash=/usr -with-mysql=/usr

45、/local/mysql -with-mysql-sock=/tmp/mysql.sock -with-mysqli=/usr/bin/mysql_config -with-pdo-mysql=shared -with-pdo-sqlite=shared -with-png-dir=/usr -with-sqlite=shared -enable-gd-native-ttf -with-xmlrpc -with-zlib -with-zlib-dir=/usr -with-iconv 如果碰到mysql_config not found的问题,有两种方法解决:1)sudo ln -s /usr

46、/local/mysql/bin/mysql_config /usr/local/bin/mysql_config将mysql_confi从你的安装目录链接到/usr/local/bin目录下,这样就可以在任意目录下访问了(也可以放到/usr/bin)2)编辑源码文件夹的site.cfg文件,去掉#mysql_config = /usr/local/bin/mysql_config前的注释,修改后面的路径为你的mysql_config真正的目录就可以了。(如果不知道mysql_config在哪里,运行命令:whereis mysql_config)使用下面的:/去掉-with-mysqli=/

47、usr/bin/mysql_config的sudo ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config./configure -prefix=/usr/local -with-config-file-path=/etc -with-apxs2=/usr/local/apache/bin/apxs -enable-bcmath -enable-calendar -enable-exif -enable-ftp -enable-gd-native-ttf -enable-libxml -enable-magic-q

48、uotes -enable-mbstring -enable-pdo=shared -enable-soap -enable-sockets -enable-zip -with-bz2 -with-curl -with-curlwrappers -with-freetype-dir -with-gd -with-gettext -with-jpeg-dir -with-kerberos -with-libxml-dir=/usr -with-mcrypt=/usr -with-mhash=/usr -with-mysql=/usr/local/mysql -with-mysql-sock=/t

49、mp/mysql.sock -with-pdo-mysql=shared -with-pdo-sqlite=shared -with-png-dir=/usr -with-sqlite=shared -enable-gd-native-ttf -with-xmlrpc -with-zlib -with-zlib-dir=/usr -with-iconv make ZEND_EXTRA_LIBS='-liconv'make installcp php.ini-production /etc/php.ini8、 安装其他扩展a) Memcache cd /usr/local/src

50、tar -zxf memcache-2.2.5.tgzcd memcache-2.2.5/phpize./configure -with-php-config=/usr/local/bin/php-config -with-zlib-dir -enable-memcachemakemake installb) Memcached (可选)1. 安装依赖库cd /usr/local/srctar -xzf libevent-2.0.13-stable.tar.gzcd libevent-2.0.13-stable./configuremakemake installln -s /usr/loca

51、l/lib/libevent-1.4.so.2 /usr/libln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib2. 安装memcachedtar -xzf memcached-1.4.7.tar.gzcd memcached-1.4.7./configure -with-libevent=/usrmakemake install3. 基本使用方法:启动:/usr/local/bin/memcached -d m 10240 -p 11211 -u nobody -l localhost-d选项是启动一个守护进程,-m是分配给Memcache使用的

52、内存数量,单位是MB,-u是运行Memcache的用户-l是监听的服务器IP地址,如果有多个地址的话,我这里指定了服务器的IP地址00,-p是设置Memcache监听的端口-c选项是最大运行的并发连接数,默认是1024,我这里设置了256,按照你服务器的负载量来设定,关闭:killall -9 memcached让Memcached开机启动查看memcached进程ps axf|grep memcached4. 加入启动项echo "/usr/local/bin/memcached -d -m 10240 -p 11211 -u nobody -l localh

53、ost " >> /etc/rc.localc) Eacceleratorcd /usr/local/srctar -jxf eaccelerator-.tar.bz2cd eaccelerator-/phpize./configure -enable-eaccelerator=shared -with-php-config=/usr/local/bin/php-configmakemake installmkdir -p /tmp/eacceleratorchmod 777 /tmp/eacceleratorecho "mkdir

54、-p /tmp/eaccelerator" >> /etc/rc.localecho "chmod 777 /tmp/eaccelerator" >> /etc/rc.locald) Imagick安装ImageMagick服务cd /usr/local/srctar -zxf imageMagick.tar.gzcd ImageMagick-*./configuremakemake install安装扩展tar -zxf imagick-2.3.0.tgzcd imagick-2.3.0/phpize./configure -with-p

55、hp-config=/usr/local/bin/php-configmakemake installe) Suhosin php安全保护系统cd /usr/local/srctar -zxf suhosin-0.9.29.tgzcd suhosin-0.9.29phpize./configuremakemake installf) ioncube_loaders PHP源码加密解密cd /usr/local/srctar -zxf ioncube_loaders_lin_x86.tar.gzcd ioncubemkdir /usr/local/ioncubemv ioncube_loader_lin_5.2.so /usr/local/ioncube/g) ZendOptimizer PHP代码优化插件cd /usr/local/srctar -zxf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gzmkdir -p /usr/local/Zend/lib/Optimizer-3.3.9/php-5.2.xcp ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/ZendOptimizer.s

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论