当前服务器环境: Centos 6
PPTP的配置主要有下面五个步骤:
- 验证内核是否加载了MPPE模块
- 安装所需的软件包
- 配置PPP和PPTP的配置文件
- 打开内核的IP转发功能
- 启动pptpd守护进程
- 配置iptables防火墙放行和转发规则
1、验证内核是否加载了MPPE模块:
1 | modprobe ppp-compress-18 && echo MPPE is ok |
2、安装所需的软件包:
安装前确保添加了 epel 源, 如果没有, 请参考 <<CentOS 添加常用 yum 源>>.
当前服务器环境: Centos 6
PPTP的配置主要有下面五个步骤:
1 | modprobe ppp-compress-18 && echo MPPE is ok |
安装前确保添加了 epel 源, 如果没有, 请参考 <<CentOS 添加常用 yum 源>>.
使用 top 命令查看进程内存使用量
1 | top |
按 Shift + m, 以内存使用量排序, 可以看到 apache 有多个进程, 占用了很多内存, 记录下单个进程占用最多内存数, 我的是 40M.
所有操作均需 root 权限
首先用 fdisk -l 查看硬盘分区情况
1 | fdisk -l |
1 2 3 4 5 6 7 8 9 | Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00097743 Device Boot Start End Blocks Id System /dev/sda1 * 1 2481 19922944 83 Linux |
只有一个分区.
新建一个分区, 用于 swap 交换.
1 | fdisk /dev/sda |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | [root@itnmg ~]# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition 删除一个分区 l list known partition types m print this menu 显示帮助菜单 n add a new partition 新建一个分区 o create a new empty DOS partition table p print the partition table 显示分区表 q quit without saving changes 不保存退出 s create a new empty Sun disklabel t change a partition's system id 改变分区类型 u change display/entry units v verify the partition table w write table to disk and exit 保存退出 x extra functionality (experts only) Command (m for help): |
我们常用的的就是中文标出来那些了.
如果要 Linux 执行计划任务, 需要安装 crontabs 服务
1 2 3 | yum install crontabs systemctl enable crond systemctl start crond |
然后编辑 /etc/crontab 文件
1 | nano /etc/crontab |
mailto 选项, 指定接收 cron 日志的邮箱, 可选项.
目前已知的提供免费 ssl 证书的只有一家. StartSSL.com, ssl 证书分为 4 类
Class 1, Class 2, Class 3, Extended Validation, 对于申请者的验证严格程序依次递增, 同时安全性也随之增强. 免费的属于 Class 1 类型.
要让 Apache 支持安全链接,即 https 访问,要有 ssl 证书及 mod_ssl.so 模块.
Apache 及其它服务安装请参考<<CentOS LAMP,vsFTP,smtp 等环境配置详解>>
1 | yum install mod_ssl |
安装完成后会在 /etc/httpd/conf.d 目录中多出个 ssl.conf 配置文件.
首先使用 ps -ef 命令确定要杀死进程的 PID, 如果想查找某个进程名字, 加上 grep 命令, 例如
1 | ps -ef | grep httpd |
得到 pid 之后, 可以使用 kill 命令结束进程
1 | kill -l pid |
通常这个命令足够用了, 如果有多个相同名字的进程, 则可能存在父子进程关系, 此时用 killall, killall 命令不需要 pid 参数, 它使用进程名字.
1 | killall httpd |
1 | vi /etc/init/start-ttys.conf |
找到tty[1-6]改成tty[1-2]
1 | vi /etc/sysconfig/init |
找到ACTIVE_CONSOLES=/dev/tty[1-6]
改成ACTIVE_CONSOLES=/dev/tty[1-2]
1 | vi /etc/sysconfig/iptables |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # Generated by iptables-save v1.4.7 on Sat Sep 29 10:26:10 2012 *nat :PREROUTING ACCEPT [40182:3767364] :POSTROUTING ACCEPT [11964:943507] :OUTPUT ACCEPT [11964:943507] -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE COMMIT # Completed on Sat Sep 29 10:26:10 2012 # Generated by iptables-save v1.4.7 on Sat Sep 29 10:26:10 2012 *filter :INPUT DROP [4:600] :FORWARD DROP [0:0] :OUTPUT DROP [0:0] -A INPUT -p gre -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m tcp --dport 20 -j ACCEPT -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m tcp --dport 1723 -j ACCEPT -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT -A INPUT -p tcp -m tcp --dport 30000:35000 -j ACCEPT -A INPUT -p tcp -m tcp --dport 65535 -j ACCEPT -A INPUT -p icmp -m icmp --icmp-type any -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A FORWARD -s 192.168.0.0/24 -o eth0 -j ACCEPT -A FORWARD -d 192.168.0.0/24 -i eth0 -j ACCEPT -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1356 -A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT |
修改 Linux 用户密码其实很简单, 只要输入 “passwd 用户名” 回车, 就会提示你输入新密码及确认新密码. 如果省略用户名则修改当前用户密码.