Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐: 强烈推荐:Ylmf OS 3.0 正式版发布附迅雷高 XP系统下硬盘安装Fedora 14图文教程
搜索:
您的位置: Linux安全网 > Linux入门 > » 正文

LAMP的详细配置(包括详细的Linux配置,适用Discuz! 环境)#S#

来源: 未知 分享至:

安装Linux

· 安装是在虚拟机上完成的,安装的版本是RedHat Enterprise 5.3,具体资源如图:

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"01\" border=\"0\" alt=\"01\" src=\"/uploads/allimg/111020/0102423342-0.jpg\" width=\"657\" height=\"442\" />

· 光盘启动开始安装,如图:

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"02\" border=\"0\" alt=\"02\" src=\"/uploads/allimg/111020/010242Eb-1.jpg\" width=\"635\" height=\"477\" />

· 选择安装的语言。(注意:如果是安装带图形界面的Linux,这里并不是选择最后的界面的语言,仅仅是安装时候的语言。)

· 选择适当的键盘。(一般我们都选美式键盘)

· 这时需要你输入它的序列号,就好像在装XP,Vista,7的时候一样,不过这个是可以跳过的,而微软的不行。需要解释一下,Linux都是免费的,这里要输入的序列号,是你购买了这个版本服务的凭证。如图:

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"03\" border=\"0\" alt=\"03\" src=\"/uploads/allimg/111020/01024244D-2.jpg\" width=\"422\" height=\"276\" />

· 如果并不是要升级原有的系统,请选择全新安装;全新安装可以选择选定磁盘上删除所有分区。相当我们在安装windows时,把分区都清除,干干净净的安装。

· 设置网络设备。按图要求,选DHCP或手动设置IP,设置计算机名,网关和DNS。(当然也可以不在这里设置,等到全部安装好后设置,这个和windows的安装非常相似。)

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"04\" border=\"0\" alt=\"04\" src=\"/uploads/allimg/111020/010242MF-3.jpg\" width=\"590\" height=\"444\" />

· 设置时区

· 设置管理员口令。(这时Linux最重要的口令。)如图:

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"05\" border=\"0\" alt=\"05\" src=\"/uploads/allimg/111020/0102425347-4.jpg\" width=\"601\" height=\"452\" />

· 安装Linux的软件定制,选择现在定制。由于这次我们只是利用Linux的服务器功能,所以很多包括桌面等各种图形应用都不需要,所以我们只要选择必要的东西即可。【除去所有的“桌面环境”,“应用程序”只保留“基于文本的互联网和编辑器”,“开发”中选择“开发工具”,再从可选软件包中加上所有gcc开头的,如下图,再选上“开发库”,“服务器”全部去除,“基本系统”中只保留“Java”,“基本”和“老的软件支持”。“基本”中可以去除一些没用的东西,“sendmail”建议保留,“语言支持”就保持“中文”和“英文”支持】

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"06\" border=\"0\" alt=\"06\" src=\"/uploads/allimg/111020/0102424640-5.jpg\" width=\"610\" height=\"408\" />

· 开始自动安装,之前它会检查一下是否有些要安装的软件需要其他软件包支持,如果提示你,就直接选择同意就好了。如图:

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"07\" border=\"0\" alt=\"07\" src=\"/uploads/allimg/111020/01024221a-6.jpg\" width=\"616\" height=\"460\" />

确认Linux的环境

· 用SSH远程连接Linux服务器,当然这需要你开始就知道你的Linux服务器的IP地址。由于Linux安装好以后防火墙自动开启的原因,默认只开了SSH的22端口允许远程连接。(屏蔽处为上回登录的机器名或IP)如图:

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"08\" border=\"0\" alt=\"08\" src=\"http://files.blogcn.com/wp04/M00/00/2B/wKgKDU24CrUAAAAAAADJy0npapQ416.jpg\" width=\"626\" height=\"351\" />

· 检查系统是否正常

a. #more /var/log/messages (检查有无系统级错误信息);

b. #dmesg (检查硬件设备是否有错误信息);

c. #ifconfig (检查网卡设置是否正确);

d. #hostname (检查本地计算机名是否正确);

e. #ping news.sina.com.cn (随便ping个网址,确认可以访问Internet,这点不是必须的,ping内网也行)

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"09\" border=\"0\" alt=\"09\" src=\"/uploads/allimg/111020/01024220H-8.jpg\" width=\"630\" height=\"492\" />

· 通过修改配置文件修改主机名

#hostname 主机名 (这个命令可以临时修改你的主机名,不过重启后失效)

在两个配置文件中修改hostname,最后系统和hostname文件才回都有效

#vi /etc/hosts (这个配置文件是对应网络中用的)

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"10\" border=\"0\" alt=\"10\" src=\"/uploads/allimg/111020/0102425H4-9.jpg\" width=\"492\" height=\"171\" />

#vi /etc/sysconfig/network (这个配置文件是对应本机的)

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"11\" border=\"0\" alt=\"11\" src=\"/uploads/allimg/111020/010242H94-10.jpg\" width=\"494\" height=\"190\" />

· 在终端字符界面修改其字体和中文字体大小:如图

#vi /etc/sysconfig/i18n

LANG="en_US.UTF-8"
LC_CTYPE="zh_CN.UTF-8"
LC_TIME="en_US.UTF-8"
SUPPORTED="zh_CN.GB18030:zh_CN.GB2312:zh_CN.GBK:zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en"
SYSFONT="latarcyrheb-sun16"

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"12\" border=\"0\" alt=\"12\" src=\"/uploads/allimg/111020/010242M56-11.jpg\" width=\"633\" height=\"187\" />

· 关闭不需要的服务 (由于Linux安装后会启动很多和我们此次配置没关系的服务,开启占资源,也存在安全隐患。类似windows启动了一些多余的服务一样),下面利用ntsysv命令列出启动的服务,如下图,我们只要保留后面的服务,其它服务一律关闭:

#ntsysv

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"13\" border=\"0\" alt=\"13\" src=\"/uploads/allimg/111020/010242A42-12.jpg\" width=\"639\" height=\"499\" />

atd

crond

irqbalance

microcode_ctl

network

sendmail

sshd

syslog

· 重启系统,那些不必要的服务关闭需要重启后生效。重启的命令也很多,一下几种都可以。

#reboot

#shutdown –r

#init 6

· 检查安装所需的开发包。利用yum程序来检查一下的开发包是否安装。(以下检查的都是RPM包)

#yum install ntp vim-enhanced vim-common gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel kernel

示例可以看出我的环境哪些包没有安装:

650) this.width=650;\" style=\"background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"14\" border=\"0\" alt=\"14\" src=\"/uploads/allimg/111020/0102423958-13.jpg\" width=\"630\" height=\"492\" />
· 安装所需的开发包。利用rpm软件来安装这些没有的开发包,相应的开发包都可以在你的RedHat光盘里Server目录下找到,首先利用ssh软件的文件传输功能把这些rpm包都转移到Linux机器的/root/Linux下,这个目录可以随便指定,我用root登录,所以放这个下面方便。其实用rpm –Uvh可以安装全部包,但有些包有依赖关系,所以建议还是一个个安装。

#rpm –ivh ntp-4.2.2p1-9.el5.i386.rpm

#rpm –ivh libtiff-devel-3.8.2-7.el5_2.2.i386.rpm

#rpm –ivh libpng-devel-1.2.10-7.1.el5_0.1.i386.rpm

#rpm –ivh libjpeg-devel-6b-37.i386.rpm

#rpm –ivh freetype-devel-2.2.1-20.el5_2.i386.rpm

· 定时校正服务器时钟,由于国家授时中心的授时服务器并不是总能连的上,所以我选择了64.90.182.55,当然你的服务器必须能上Internet。

#crontab –e

加入一行:

*/30 * * * * ntpdate 64.90.182.55 (表示服务器每30分钟和授时服务器同步一次时间)

· 编译一些安装所需的源码包(默认所有的二进制包都已经copy到/root/Linux中,默认位置就在此目录中)

a. 安装ZLIB包

#tar xzvf zlib-1.2.3.tar.gz

#cd zlib-1.2.3

#./configure --prefix=/usr/local/zlib

#make

#make install

b. 安装GD2包 (不知道为什么安装GD时,第一次make出错,我再次执行make就对了,奇怪)

#cd ..

#tar xzvf gd-2.0.35.tar.gz

#cd gd-2.0.35

#./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/lib –-with-png=/usr/lib --with-freetype=/usr/lib

#make

#make install

c. 安装LibXML2包

#cd ..

#tar xzvf libxml2-2.6.19.tar.gz

#cd libxml2-2.6.19

#./configure --prefix=/usr/local/libxml

#make

#make install

d. 安装LibMcrypt包

#cd ..

#tar xzvf libmcrypt-2.5.7.tar.gz

#cd libmcrypt-2.5.7

#./configure --prefix=/usr/local/libmcrypt

#make


Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史