您的位置:首页 > Web前端

4000 Fedora21系统配置

2016-12-02 15:39 375 查看
==============================================================

作者:shanzongyingcao

网址:http://blog.csdn.net/shanzongyingcao

版权没有,但是转载请保留此段声明

==============================================================

本文整理Fedora21系统的一些配置方法,所有方法几乎全部来源于网上资料,这里仅是整理一下调试笔记。

==============================================================

Fedora21系统配置

参考Timesys Fedora18

1)Fedora21系统配置,同Timesys Fedora18系统配置类似,参考[ Timesys Fedora18系统配置 ]。

2)下面只介绍一些不同的地方。

telnet服务启动不同

-1) 具体改为运行systemctl enable telnet.socket。

原文摘要如下:

I’m studying linux server book. I’m now seeing telnet.

they say after install telnet, I should modify telnet configure in /etc/xinetd.d/telnet but there is no telnet file. but install is well finished.

Fedora 23 is based on Systemd. The Fedora 23 telnet-server (that’s what you installed)uses sytemd service units to manage the telnetd service. To enable it, run systemctl enable telnetd.socket and to start it, systemctl start telnetd.socket. Use this /usr/lib/systemd/system/telnet.socket instead for checking configuration.

设置启动内核

1)GRUB2 与 GRUB 单点配置文件的方式不同,它通过读取类似 udev/systmed 风格的一系列预制配置文件模板外加 /etc/default/grub 自定义变量文件,然后用 grub2 工具生成最后的配置文件 /boot/grub2/grub.cfg(强烈建议不要手动编辑该文件)。

2)由于无法确定每次调用 grub2-mkconfig 后生成菜单的顺序,所以指定默认的引导内核会稍微复杂些:

编辑 /etc/default/grub 文件,添加 GRUB_DEFAULT=saved 变量;

3)运行 grub2-mkconfig -o /boot/grub2/grub.cfg 来刷新配置文件;

4)使用 grub2-set-default <具体名称或以0为基数的自然数> 的方式来指定默认引导内核;

如果要查询当前设置的话,使用 grub2-editenv list 既可。

PS:现在每个内核都生成对应的 Recovery Mode 引导选项。

使用iptables实现内网的ftp端口映射

1)参考[linux下使用iptables实现内网的ftp端口映射 ]。

2)具体Fedora21:

有两台机器,其中一台A 有内网和外网,B机器只有内网。

想达到的目的: 通过A机器的外网(端口2121)去访问B机器的ftp(21),不影响A机器外网ftp端口21的访问;

环境:

A机器外网IP为 192.168.1.106(wlp1s0) 内网IP为 192.168.0.107 (enp4s0)

B机器内网为 192.168.0.108

3)实现方法:

让你的linux支持ftp的端口转发

modprobe ip_nat_ftp ###加载ip_nat_ftp模块(若没有编译进内核),以使ftp能被正确NAT。也可是nf_nat_ftp等。

modprobe ip_conntrack_ftp ###加载ip_conntrack_ftp模块。也可是nf_conntrack_ftp

在A机器上打开端口转发功能

sysctl -w net.ipv4.ip_forward = 1

在A机器上创建iptables规则

iptables -t nat -I PREROUTING -d 192.168.1.106 -p tcp –dport 2121 -j DNAT –to 192.168.0.108:21 (把访问外网2121端口的包转发到内网ftp服务器)

iptables -t nat -I POSTROUTING -d 192.168.0.108-p tcp –dport 21 -j SNAT –to 192.168.0.107(把到内网ftp服务器的包回源到内网网卡上,不然包只能转到ftp服务器,而返回的包不能到达客户端)

4)透传功能设置(B机通过A机,上外网):

sysctl -w net.ipv4.ip_forward = 1

iptables -t nat -A POSTROUTING -o wlp1s0 -j MASQUERADE

5) 动态获取ip

wifiip=
ifconfig wlp1s0 |grep "inet" |head -n 1 |awk '{print $2}'


echo “wifi ip $wifiip”

6)windows使用ftp工具下载地址:

[FileZilla客户端 ]。

使用Netbios Name及用WINS解析域名

1)参考[Linux使用Netbios Name及用WINS解析域名 ]。

2)让Windows通过域名访问Linux,Fedora21系统设置:

1)yum install samba

2)vi /etc/samba/smb.conf

打开netbios name一项,并给出一个netbios名。

不设置netbios name时,默认为hostname。

3)重启smb和nmb服务

systemctl restart/start/enable smb.service

systemctl restart/start/enable nmb.service

3)windows可以使用局域网扫描IP工具:

1)nbtscan-1.0.35.exe;

2)Advanced IP Scanner,下载[Advanced IP Scanner ]

粗略删除桌面及应用程序

1)先登录桌面,活动—>软件—>已安装—>移除所有软件。

2 )dnf erase gnome*(前后都加*号,包括git)

dnf erase desktop*(前后都加*号,包括yelp)

dnf erase x11*(前后都加*号)

dnf erase qt*(前后都加*号)

dnf erase libpinyin*(前后都加*号)

dnf erase yelp*(前后都加*号)

dnf erase backgrounds*(前后都加*号)

3)在进文本界面,运行rpm -qa查看安装的软件,用yum erase *,卸载下述软件:

有*gnome,

,gnome*,

*x11,

x11*,

yelp, media-player-info, libpinyin, desktop*, *freedesktop, open-vm-tools-desktop,

*qt,

qt*。

4) yum clean all(/var/cache/yum)

dnf clean all(/var/cache/yum)

5) rm -rf /usr/share/doc

保留/usr/share/locale,保留e*,f**,l*,r*,z*(支持各国语言有关)

添加计划任务

1)参考[Crontab 计划任务用法详解 ]

2)每天凌晨2:00,删除一些日志文件

[root@localhost ~]# crontab -e

0 2 * * * rm -rf /var/log/journal/1b……/*

0 2 * * * rm -rf /var/tmp/abrt/*

定期删除journal

1)参考[Can I remove files in /var/log/journal and /var/cache/abrt-di/usr? ]

journal logs:

Yes you can delete everything inside of /var/log/journal/* but do not delete the directory itself. You can also query journalctl to find out how much disk space it’s consuming:

journalctl –disk-usage

You can control the size of this directory using this parameter in your /etc/systemd/journald.conf:

SystemMaxUse=50M

You can force a log rotation:

sudo systemctl kill –kill-who=main

–signal=SIGUSR2 systemd-journald.service

NOTE: You might need to restart the logging service to force a log rotation, if the above signaling method does not do it. You can restart the service like so:

sudo systemctl restart systemd-journald.service

文件界面屏闪

启动参数添加 nomodeset vga=791

应该显示驱动改为vesa,791分辨率可能为1024x768

安装gdbserver

yum install gdb-gdbserver

安装后,有命令gdbserver

配置VNC远程登录

1)yum install vnc

yum install tigervnc-server

2)运行vncpasswd,设置密码

3)设置开机自动运行如下命名:

x0vncserver PasswordFile=/root/.vnc/passwd

此命令必须在桌面启动后,再运行。

4)设置桌面启动后,自动运行应用程序:

在/root/.config下,创建目录autostart,在此目录下创建文件desktop.desktop,内容如下:

[Desktop Entry]

Type=Application

Name=desktop

Comment=desktop

Exec=/work/desktop

Terminal=false

OnlyShowIn=GNOME;

设置后,桌面启动后,自动运行/work/desktop脚本。

设置音频

Play命令

sudo apt-get install sox

设置音量:

modprobe snd-pcm-oss

amixer -c 0 sset Master 0 90% 90% unmute

设置root自动登录

修改: /etc/gdm/custom.conf文件, 将自动登录 启用为true, 然后自动登录的名字设为root 即可:

[daemon]

AutomaticLoginEnable=true

AutomaticLogin=root

设置默认启动内核(参照他们总结)

GRUB2 与 GRUB 单点配置文件的方式不同,它通过读取类似 udev/systmed 风格的一系列预制配置文件模板外加 /etc/default/grub 自定义变量文件,然后用 grub2 工具生成最后的配置文件 /boot/grub2/grub.cfg(强烈建议不要手动编辑该文件)。

由于无法确定每次调用 grub2-mkconfig 后生成菜单的顺序,所以指定默认的引导内核会稍微复杂些:

编辑 /etc/default/grub 文件,添加 GRUB_DEFAULT=saved 变量;

运行 grub2-mkconfig -o /boot/grub2/grub.cfg 来刷新配置文件;

使用 grub2-set-default <具体名称或以0为基数的自然数> 的方式来指定默认引导内核;

如果要查询当前设置的话,使用 grub2-editenv list 既可。

PS:现在每个内核都生成对应的 Recovery Mode 引导选项。

配置 journald.conf

参照:https://www.cnblogs.com/hadex/p/6837688.html

[Journal]

日志存储到磁盘

Storage=persistent

压缩日志

Compress=yes

为日志添加序列号

Seal=yes

每个用户分别记录日志

SplitMode=uid

日志同步到磁盘的间隔,高级别的日志,如:CRIT、ALERT、EMERG 三种总是实时同步

SyncIntervalSec=1m

即制日志的最大流量,此处指 30s 内最多记录 100000 条日志,超出的将被丢弃

RateLimitInterval=30s

与 RateLimitInterval 配合使用

RateLimitBurst=100000

限制全部日志文件加在一起最多可以占用多少空间,默认值是10%空间与4G空间两者中的较小者

SystemMaxUse=64G

默认值是15%空间与4G空间两者中的较大者

SystemKeepFree=1G

单个日志文件的大小限制,超过此限制将触发滚动保存

SystemMaxFileSize=128M

日志滚动的最大时间间隔,若不设置则完全以大小限制为准

MaxFileSec=1day

日志最大保留时间,超过时限的旧日志将被删除

MaxRetentionSec=100year

是否转发符合条件的日志记录到本机的其它日志管理系统,如:rsyslog

ForwardToSyslog=yes

ForwardToKMsg=no

是否转发符合条件的日志到所有登陆用户的终端

ForwardToWall=yes

MaxLevelStore=debug

MaxLevelSyslog=err

MaxLevelWall=emerg

ForwardToConsole=no

/#TTYPath=/dev/console

/#MaxLevelConsole=info

/#MaxLevelKMsg=notice
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: