换源,安装ssh,lamp

本文档详细介绍了如何在Ubuntu服务器上更换软件源为163源,然后逐步安装SSH服务和配置允许root登录,接着安装LAMP(Linux、Apache、MySQL、PHP)环境,包括修改Apache的安全配置,隐藏版本信息,以及安装必要的PHP扩展。
1.换源
cd /etc/apt/
vim soursec.list

```
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

```

apt-get update && apt-get upgrade

apt-get clear //删除已经更新过的安装包

2.安装ssh
apt-get install ssh

cd /etc/ssh

vim sshd_conf

修改sshd_conf文件使他可以使用root登陆
输入”sudo gedit /etc/ssh/sshd_config”–>回车–>把配置文件中的”PermitRootLogin without-password”加一个”#”号,把它注释掉–>再增加一句”PermitRootLogin yes”–>保存,修改成功。

shell root登陆


3.安装LAMP环境

安装apache
apt-get install apache2
修改安全配置 cd /etc/apache2  vim apache2.conf
(1)关闭列目录
<Directory /var/www/>
        Options Indexes FollowSymLinks//Options FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
(2)apache2版本信息隐藏

# 解决问题1 Apache响应消息header中的Server带有Apache的版本信息
ServerTokens ProductOnly
# 解决问题2:Apache的错误返回页面中,也包含同样的信息。除了Apache的信息外,还包括ip地址和端口
ServerSignature Off    
安装 mysql

apt-get install mysql-server


安装php apt-get install php5

安装 php常用拓展
apt-get install php5-mysql php5-curl php5-gd php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-idn

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值