页面“Freebsd桌面初始化”与“Salt安装”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
 
 
第1行: 第1行:
=用户需知=
+
==pre==
<pre>
+
master 192.168.23.50
 
 
FreeBSD11  FreeBSD12
 
 
 
如果是有兴趣,要有进步的 直接上freebsd 
 
 
 
[https://www.v2ex.com/t/460137 freebsd 有这么强悍呢?能做什么呢]
 
 
 
今天在家成功安装了freebsd12  并连上wifi  freebsd11连不上
 
 
 
现在双硬盘也是成功的 1t 作为了home  昨天的安装好了 再mount硬盘居然是不行的,一开机就死了了,不过现在是GPT加bios 兼容模式
 
gnome3 to leav  xfce is good for use
 
 
 
桌面用户如何? 家里不用理 带个 freebsd latop 上班就行了
 
 
 
 
 
这几天更新firefox 70 失败 用port 居然有很多软件消失了 ,例如 fcitx-qt5  liboffice
 
 
 
</pre>
 
 
 
如果你读过我的TrueOS 评论并且有兴趣尝试使用桌面 BSD 或已经使用 TrueOS,请不要担心(这对于生活来说也是一个很好的建议)。TrueOS 的所有桌面元素都将剥离到 Project Trident。目前,Project Trident 网站的细节不多。他们仿佛还在进行剥离的幕后工作。
 
 
 
如果你目前拥有 TrueOS,则无需担心迁移。TrueOS 团队表示,“对于那些希望迁移到其他基于 FreeBSD 的发行版,如 Project Trident 或 GhostBSD 的人而言将会有迁移方式。
 
 
 
[https://zhuanlan.zhihu.com/p/39736459 TrueOS不再想要成为“桌面 BSD”了]
 
 
 
 
 
TW的文档是新式,天朝的太老了
 
https://www.freebsd.org/doc/zh_TW.UTF-8/books/handbook/index.html
 
 
 
=freebsd12 on elitebook 问题=
 
1. 中文输入法老是调不出来  无论是fcitx  ibus scim
 
 
 
2. lxqt 界面 会假死,虽然在远程还可以ssh
 
 
 
 
 
=pre-configure=
 
<pre>
 
Pkg源地址更换为USTC:
 
 
 
官方源配置是 /etc/pkg/FreeBSD.conf ,请先检查该文件内容。注意其中的 url 参数配置了官方仓库的地址,我们需要把它替换为镜像站的地址。 该配置文件是 FreeBSD 基本系统的一部分,会随着 freebsd-update 更新,请不要直接修改,而是创建 /usr/local/etc/pkg/repos/FreeBSD.conf 覆盖配置,文件内容如下:
 
 
 
FreeBSD: {
 
url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
 
}
 
如果要使用滚动更新的 latest 仓库,把 url 配置最后的 quarterly 换成 latest 即可。 修改配置后,运行 pkg update -f 更新索引。
 
 
 
</pre>
 
 
 
=configure start=
 
==0基本系统已安装 没有gui==
 
 
 
 
 
[[安装freebsd]]
 
 
 
[http://blog.linuxchina.net/?p=1047 freebsd 添加用户]
 
 
 
===字体 ===
 
<pre>cd /usr/ports/x11-fonts/wqy
 
make install clean
 
#没有字体 显示中文时为乱码
 
 
 
编辑/usr/local/etc/fonts/conf.d/85-wqy.conf这个文件,找到下面这两行( 现在不是这二行了 应该在第99、100行):
 
 
 
查找  compare="less_eq"  freebsd12 有5个
 
 
 
<test name="size" compare="less_eq"><int>16</int></test>
 
<edit name="antialias" mode="assign"><bool>false</bool></edit>
 
把less_eq后面的int值从16改成8即可。这两行的意思是对于所有小于16号的字体都禁用抗锯齿(match居然写的target=”font”,匹配了所有字体),一个最简单的workaround就是把禁用抗锯齿的字号改小一点,8号是个不错的值,因为太小的字用抗锯齿反而会模糊。
 
 
 
这样字体就美美的 </pre>
 
 
 
https://www.librehat.com/solve-freebsd-dragonflybsd-font-antialiasing-settings-invalid-issues/
 
https://www.freebsdchina.org/forum/viewtopic.php?p=291166&sid=3b2dad0b46fafdb9a54757d673fef516
 
 
 
===xorg GUI 开始 ===
 
<pre>
 
pkg install xorg
 
 
 
 
 
pkg install xf86-video-intel​​​​​​​
 
 
 
pkg  install xrandr
 
 
 
/etc/rc.conf
 
hald_enable="YES"
 
dbus_enable="YES"
 
 
 
 
 
pkg install gdm  #  gnome3-lite #gnome3 有点显卡闪屏
 
</pre>
 
 
 
===slim===
 
<pre>
 
pkg install -y slim-themes slim
 
/usr/local/etc/slim.conf
 
#sessiondir  /usr/local/share/xsessions
 
# ...
 
current_theme fbsd
 
 
 
ls  /usr/local/share/slim/themes/
 
archlinux-simple    fbsd                gentoo-simple      mindlock            scotland-road
 
capernoited        fingerprint        gnewsense          parallel-dimensions subway
 
debian-moreblue    flat                lake                rainbow            wave
 
default            flower2            lunar              rear-window        zenwalk
 
 
 
 
 
 
 
</pre>
 
====usage====
 
<pre>单用户环境
 
要将SLiM配置为加载某个特定的环境,只需编辑~/.xinitrc 如下:
 
 
 
#!/bin/sh
 
 
 
#
 
# ~/.xinitrc
 
#
 
# Executed by startx (run your window manager from here)
 
#
 
 
 
exec [session-command]
 
将[session-command]替换为适当的会话命令。例如:
 
 
 
exec awesome
 
exec dwm
 
exec startfluxbox
 
exec fvwm2
 
exec gnome-session
 
exec openbox-session
 
exec startkde
 
exec startlxde
 
exec startxfce4
 
exec enlightenment_start
 
</pre>
 
 
 
https://wiki.archlinux.org/index.php/SLiM_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
 
 
 
https://www.c0ffee.net/blog/freebsd-on-a-laptop/#slim
 
 
 
===xfce ===
 
<pre>
 
 
 
pkg install xfce
 
 
 
cat .xinitrc
 
. /usr/local/etc/xdg/xfce4/xinitrc
 
#ck-launch-session /usr/local/bin/startlxqt
 
#exec awesome
 
export LC_ALL=zh_CN.UTF-8
 
export LANGUAGE=zh_CN.UTF-8.UTF-8
 
export LANG=zh_CN.UTF-8.UTF-8
 
#fcitx &
 
 
 
cat /etc/rc.conf
 
hostname="bsdelite.linuxsa.org"
 
#wlans_iwm0="wlan0"
 
#ifconfig_wlan0="WPA DHCP"
 
sshd_enable="YES"
 
dbus_enable="YES"
 
hald_enable="YES"
 
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
 
dumpdev="AUTO"
 
ifconfig_em0="DHCP"
 
slim_enable="yes"
 
defaultrouter="192.168.10.1"
 
 
 
fcitx wubi  在xfce 是成功的
 
</pre>
 
 
 
===lxqt ===
 
<pre>
 
pkg install lxqt    # sudo pkg delete lxqt # 输入法不好用 老调不出来  放弃
 
</pre>
 
https://wiki.freebsd.org/LXQt
 
 
 
===awesome===
 
<pre>
 
pkg install awesome
 
# cp /usr/local/etc/xdg/awesome/rc.lua .config/awesome/ #这个不要,我们后面会操作的 在配置里面
 
echo "exec awesome" >> .xinitrc
 
chmod +x ~/.xinitrc
 
</pre>
 
===时间设置===
 
<pre>
 
先用bsdconfig-->network -->  不行再date
 
 
 
date 201908122145
 
2019年 8月12日 星期一 21时45分00秒 CST
 
 
 
</pre>
 
 
 
===xrand===
 
<pre>
 
#at  elitebook
 
xrandr --output DP2 --same-as  eDP1  --mode 1366x768  --output DP2 --mode 1920x1080
 
 
 
#I3只有这个有效果  上面那个 是完全 只有一半 感觉没有了另外一半  哈哈
 
xrandr --output DP2      --mode 1920x1080    --output eDP1 --off
 
 
 
 
 
 
 
 
 
#at 神舟
 
#xrandr --output HDMI-1 --same-as  LVDS-1  --mode 1366x768  --output HDMI-1 --mode 1920x1080
 
 
 
##kali
 
#on home
 
# if vga on home  24 1920*1080
 
#xrandr --output VGA-1 --same-as  LVDS-1  --mode 1366x768  --output VGA-1 --mode 1920x1080
 
 
 
#if hdmi on home
 
#xrandr --output HDMI-1 --same-as  LVDS-1  --mode 1366x768  --output HDMI-1 --mode 1920x1080
 
#只开启外外接显示器
 
xrandr --output  HDMI-1  --mode 1920x1080 --output LVDS-1 --off
 
 
 
#HDMI-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 527mm x 296mm
 
 
 
#xrandr --output HDMI-1  --same-as  --mode 1366x768  --output HDMI-1 --mode 1920x1080+0+0
 
# on work
 
#xrandr --output VGA1  --same-as LVDS1 --mode  1920x1080  --output LVDS1 --mode 1366x768
 
 
 
 
 
</pre>
 
 
 
===wifi===
 
<pre>
 
 
 
首先 安装freebsd12 时,就选择wifi连接网络,不要插网线
 
 
 
Add an entry for this network to /etc/wpa_supplicant.conf. If the file does not exist, create it.
 
 
 
network={
 
ssid="myssid"
 
psk="mypsk"
 
}
 
 
 
Add entries to /etc/rc.conf to configure the network on startup:
 
 
 
wlans_ath0="wlan0"
 
ifconfig_wlan0="WPA SYNCDHCP"
 
 
 
 
 
Restart the computer, or restart the network service to connect to the network:
 
 
 
# service netif restar
 
 
 
</pre>
 
https://www.freebsd.org/doc/handbook/network-wireless.html
 
 
 
===显示器 之亮度 及双显示器 ===
 
<pre>
 
 
 
#我的
 
root@bsd-latop:~ # sudo kldload acpi_video; sudo sysctl hw.acpi.video.crt0.brightness=30
 
hw.acpi.video.crt0.brightness: 80 -> 30
 
 
 
查看
 
sysctl hw.acpi.video
 
 
 
hw.acpi.video.out2.active: 1
 
hw.acpi.video.out1.active: 1
 
hw.acpi.video.out0.active: 1
 
hw.acpi.video.ext2.active: 1
 
hw.acpi.video.ext1.active: 1
 
hw.acpi.video.ext0.active: 1
 
hw.acpi.video.lcd0.active: 1
 
hw.acpi.video.crt0.levels: 80 50 0 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 69 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
 
hw.acpi.video.crt0.economy: 50
 
hw.acpi.video.crt0.fullpower: 80
 
hw.acpi.video.crt0.brightness: 80
 
hw.acpi.video.crt0.active: 1
 
 
 
 
 
别人的例子
 
kldload acpi_video; sysctl hw.acpi.video.lcd0.brightness=30 试试
 
 
 
 
 
</pre>
 
 
 
[http://www.bsdart.org/freebsd-%e4%b8%8b%e5%8f%8c%e6%98%be%e7%a4%ba%e5%99%a8%e7%9a%84%e8%ae%be%e7%bd%ae/ FreeBSD 下双显示器的设置]
 
 
 
===pkg 源更新和系统更新===
 
<pre>
 
mkdir -p /usr/local/etc/pkg/repos/
 
 
 
sudo pkg install security/ca_root_nss
 
vi /usr/local/etc/pkg/repos/FreeBSD.conf
 
FreeBSD: {
 
  url: "pkg+https://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
 
#url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
 
}
 
 
 
 
 
 
 
#系统更新
 
pkg update -f
 
pkg update
 
pkg upgrade
 
 
 
 
 
</pre>
 
 
 
[https://www.freebsd.org/releases/12.1R/installation.html FreeBSD 12.1-RELEASE Installation Instructions]
 
https://mirrors.ustc.edu.cn/help/freebsd-pkg.html
 
 
 
https://www.freebsd.org/doc/handbook/pkgng-intro.html
 
 
 
===更新单个软件===
 
<pre>
 
 
 
这里以firefox为例子
 
 
 
pkg install firefox #就可以直接升级了
 
 
 
Installed packages to be UPGRADED:
 
firefox: 68.0.1_1,1 -> 69.0.2,1
 
telegram: 1.4.1.g20161227_5 -> 1.4.1.g20161227_6
 
protobuf: 3.7.1,1 -> 3.9.2,1
 
libevent: 2.1.10 -> 2.1.11
 
libqtxdg: 3.3.0 -> 3.3.0_1
 
 
 
Installed packages to be REINSTALLED:
 
mysql57-server-5.7.27 (direct dependency changed: perl5)
 
 
 
Number of packages to be upgraded: 5
 
Number of packages to be reinstalled: 1
 
 
 
The operation will free 1 MiB.
 
64 MiB to be downloaded.
 
 
 
</pre>
 
 
 
===ports 加速===
 
<pre>
 
sudo pkg install axel
 
 
 
vi /etc/make.conf
 
#加入以下内容
 
FETCH_CMD=axel
 
FETCH_BEFORE_ARGS= -n 10 -a
 
FETCH_AFTER_ARGS=
 
DISABLE_SIZE=yes
 
MASTER_SITE_OVERRIDE?=\
 
http://ports.hshh.org/${DIST_SUBDIR}/\
 
http://ports.cn.freebsd.org/${DIST_SUBDIR}/\
 
#ftp://ftp.freeBSDchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/
 
MASTER_SITE_OVERRIDE?=http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/${DIST_SUBDIR}/
 
MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP}
 
#MASTER_SITE_OVERRIDE?=http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/${DIST_SUBDIR}/
 
 
 
vi /etc/portsnap.conf
 
 
 
 
SERVERNAME=portsnap.freebsd.org
 
 
 
修改成:
 
 
 
SERVERNAME=portsnap.hshh.org
 
 
 
这个是他的更新服务器。另外还有几个国内比较快的portsnap服务器:
 
 
 
portsnap.hshh.org
 
 
 
portsnap2.hshh.org
 
 
 
portsnap3.hshh.org (网通)
 
 
 
portsnap4.hshh.org
 
</pre>
 
 
 
===更新ports===
 
<pre>
 
 
 
在 /etc/make.conf 中添加以下内容(如果文件不存在,则新建之):
 
 
 
MASTER_SITE_OVERRIDE?=http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/${DIST_SUBDIR}/
 
 
 
 
 
 
 
cat  /etc/portsnap.conf  | grep cn
 
SERVERNAME=portsnap.cn.FreeBSD.org
 
 
 
fetch 获取数据
 
extract 释放全部ports
 
update 更新ports
 
第一次使用可以portsnap fetch extract
 
  
以后使用可以 portsnap fetch update
+
client 192.168.20.208
portsnap extract; portsnap update
 
  
现在的亚洲pkg mirrors
+
  个人观点puppet最大缺点就是默认情况下Agent每隔30分钟向master同步状态,master主动推送功能比较薄弱(2.7版本),ansible基于SSH服务执行,如果服务器过多不建议使用,他是使用轮训的方式。Salt基于消息队列。性能相当好,适合大量生产环境。
pkg0.twn.freebsd.org
 
</pre>
 
  
http://mirrors.ustc.edu.cn/help/freebsd-ports.html
 
  
[https://blog.csdn.net/joyous/article/details/81990019 FreeBSD 11.1 发行版在线升级到 FreeBSD 11.2 发行版]
 
  
[https://blog.csdn.net/lanzh_syf/article/details/86599445 FreeBSD 12 国内源提速 pkg 和 ports 做个笔记]
 
  
[https://www.cnblogs.com/apexchu/p/4131821.html Freebsd 下如何最有效率的安装软件]
+
[https://www.zhihu.com/question/22707761 SaltStack 与 Ansible 选择]
 +
[https://www.centos.bz/2016/12/saltstack-event-driven-watching-event/ SaltStack事件驱动(1) – 监视事件]
  
[http://blog.linuxchina.net/?p=1039 freebsd 安装ports以及加速]
+
==第一 添加RPM源==
 
 
[https://blog.csdn.net/pengsixiang/article/details/4224141 使用国内镜像给FreeBSD的Ports安装加速]
 
 
 
[https://blog.csdn.net/pengsixiang/article/details/7458136 FreeBSD Fetch和Tar的妙用]
 
 
 
 
 
[https://www.zhihu.com/question/264793642 怎么看待FreeBSD官方对镜像站的封闭管理]
 
 
 
=20190808 new add=
 
 
<pre>
 
<pre>
root@freebsd:/home/evan # cat /etc/fstab
+
#1.Run the following commands to install the SaltStack repository and key:
# Custom /etc/fstab for FreeBSD VM images
+
#sudo yum install https://mirrors.aliyun.com/saltstack/yum/redhat/salt-repo-latest-2.el7.noarch.rpm  -y
/dev/gpt/rootfs  /      ufs    rw      1       1
 
/dev/gpt/swapfs  none    swap    sw      0      0
 
 
 
 
 
% echo 'ck-launch-session /usr/local/bin/startlxqt' > ~/.xinitrc
 
 
 
pkg install xorg
 
 
 
 
 
安装:
 
pkg install xorg
 
//在/etc/rc.conf文件内添加如下内容:
 
 
 
 
 
cat  /etc/rc.conf
 
hostname="freebsd"
 
moused_enable="YES"
 
moused_nodefault_enable="YES"
 
dbus_enable="YES"
 
hald_enable="YES"
 
ifconfig_DEFAULT="DHCP inet6 accept_rtadv"
 
sshd_enable="YES"
 
slim_enable="yes"
 
#lightdm_enable="YES"
 
 
 
 
 
pkg install xrandr  remmina synapse
 
 
 
pkg  install awesome 
 
 
 
pkg install telegram # or pidgim </pre>
 
https://forums.freebsd.org/threads/running-telegram-gui.51494/
 
  
添加 新硬盘  这个会出错  只有在安装时就两个硬盘 并分区就没事
+
sudo yum install https://mirrors.aliyun.com/saltstack/yum/redhat/salt-repo-latest.el7.noarch.rpm -y #201912
  
 +
sudo yum install https://mirrors.aliyun.com/saltstack/yum/redhat/salt-repo-latest-2.el6.noarch.rpm-y
 +
#yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest-2.el6.noarch.rpm -y
 +
#yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest-2.el7.noarch.rpm -y
  
Aug 9 2019
+
#2.Run sudo yum clean expire-cache
 +
yum clean expire-cache
  
[https://blog.csdn.net/tg2003/article/details/80569955 FreeBSD本地化]
+
#3.Install the salt-minion, salt-master, or other Salt components:
 +
sudo yum install salt-master -y
 +
sudo yum install salt-minion -y
 +
sudo yum install salt-ssh -y
 +
sudo yum install salt-syndic -y
 +
sudo yum install salt-cloud -y
 +
sudo yum install salt-api -y
  
  
[http://blog.linuxchina.net/?p=1039 freebsd 安装ports以及加速]
 
  
[https://blog.csdn.net/pengsixiang/article/details/4224141 使用国内镜像给FreeBSD的Ports安装加速]
+
##ios old
 +
#7系列
 +
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 +
#6系列
 +
rpm -ivh http://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpm
 +
#rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
 +
#7系列
 +
rpm -ivh http://mirrors.aliyun.com/epel/7/x86_64/e/epel-release-7-7.noarch.rpm
 +
#5系列
 +
wget http://mirrors.sohu.com/fedora-epel/5/x86_64/epel-release-5-4.noarch.rpm
 +
rpm -ivh epel-release-5-4.noarch.rpm
 +
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL #导入密钥
 +
yum info salt</pre>
  
[https://blog.csdn.net/pengsixiang/article/details/7458136 FreeBSD Fetch和Tar的妙用]
+
==第二 on master==
 +
<pre>useradd salt
 +
yum install salt-master -y
  
 +
vi /etc/salt/master
 +
# The address of the interface to bind to
 +
interface: masterip #前面要有两个空格
 +
# The tcp port used by the publisher
 +
  publish_port: 4505#前面要有两个空格
 +
#自动认证
 +
auto_accept: True
 +
# The user to run the salt-master as. Salt will update all permissions to
 +
# allow the specified user to run the master. If the modified files cause
 +
# conflicts set verify_env to False.
 +
user: root
 +
# interface used for the file server, authentication, job returnes, etc.
 +
  ret_port: 4506#前面要有两个空格
  
[https://www.zhihu.com/question/264793642 怎么看待FreeBSD官方对镜像站的封闭管理]
 
  
 +
systemctl restart salt-master
 +
systemctl  enable salt-master
  
[https://blog.csdn.net/lanzh_syf/article/details/86635083 freebsd12 安装gnome3图形界面]
+
cat  /etc/salt/master | grep -v ^# |sort -u
  
 +
#cento6
 +
/sbin/chkconfig --add nginx
 +
/sbin/chkconfig  --level  345 nginx  on
  
 
docker on freebsd
 
https://wiki.freebsd.org/Docker
 
 
jails
 
 
 
---------------------
 
 
原文链接:https://blog.csdn.net/MoeDisk/article/details/87028238
 
 
 
==1 安装 gui 相关==
 
=== 安装===
 
<pre>#不用 portnaps 直接pkg
 
#昨晚这个默认居然是没有cn的 我去 搞半天 ,还是改一下比较好滴
 
vi /etc/portsnap.conf
 
SERVERNAME=portsnap.cn.FreeBSD.org
 
 
#不安装gnome3 就没有gdm,但是没办法单独安装gdm 
 
pkg install  xorg mate  slim  #没了 xf86-video-fbdev ?
 
 
#[Install CINNAMON Desktop Environment]
 
pkg install cinnamon
 
#20170331
 
#Lightdm is in the ports tree.
 
pkg install x11/lightdm
 
 
For lightdm to function, it requires one of the available greeters to be
 
installed, which are available in the ports tree at x11/lightdm-*greeter*
 
 
# 记得要添加这个DM Add the following lines to /etc/rc.conf to enable the LightDM:
 
lightdm_enable="YES"
 
 
# pkg install terminology</pre>
 
 
===配置 和开机自启动===
 
<pre>vi /etc/fstab
 
proc /proc procfs rw 0 0
 
sysrc  'hald_enable=YES'  'dbus_enable=YES' 'slim_enable=YES'    #'gdm_enable=YES'
 
 
</pre>
 
</pre>
  
=== 中文化===
+
==第三 client==
<pre>  
+
<pre>useradd salt
 
+
yum install salt-minion -y
只有中文化后 才能调用fcitx 五笔哦 不然没中文输入
 
2019
 
 
 
编辑用户的环境文件:
 
#vi ~/.cshrc      //增加如下内容
 
setenv LANG        zh_CN.UTF-8   
 
setenv LC_CTYPE    zh_CN.UTF-8
 
setenv LC_ALL      zh_CN.UTF-8
 
//添加完后退出当前会话,重新进入。
 
#locale    //显示当前用户环境
 
LANG=zh_CN.UTF-8
 
LC_CTYPE="zh_CN.UTF-8"
 
LC_COLLATE="zh_CN.UTF-8"
 
LC_TIME="zh_CN.UTF-8"
 
LC_NUMERIC="zh_CN.UTF-8"
 
LC_MONETARY="zh_CN.UTF-8"
 
LC_MESSAGES="zh_CN.UTF-8"
 
LC_ALL=zh_CN.UTF-8
 
 
 
 
 
用户级:
 
修改用户根目录文件.login_conf: 这个好像加了无效 201908
 
me:\
 
        :lang=zh_CN.UTF-8:\
 
        :setenv=LC_ALL=zh_CN.UTF-8:\
 
        :setenv=LC_CTYPE=zh_CN.UTF-8:\
 
        :setenv=LC_COLLATE=zh_CN.UTF-8:\
 
        :setenv=LC_TIME=zh_CN.UTF-8:\
 
        :setenv=LC_NUMERIC=zh_CN.UTF-8:\
 
        :setenv=LC_MONETARY=zh_CN.UTF-8:\
 
        :setenv=LC_MESSAGES=zh_CN.UTF-8:\
 
        :charset=UTF-8:\
 
        :xmodifiers="@im=SCIM": #这里我假设你使用SCIM
 
在英文界面下运行中文输入法:
 
  
startx 开启 gnome 或 gdm 开始登录gnome
+
vi /etc/salt/minion #修改配置请见下面的非交互
 +
#编辑11行:#master: salt
 +
master: masterip
 +
master: 192.168.23.50
  
我在 ~/.xinitrc中加入了:
+
103 id: ad_admin
  
 +
# Overwrite the default tcp ports used by the minion when in tcp mode
 +
tcp_pub_port: 4510
 +
tcp_pull_port: 4511
  
cat .xinitrc
+
cp /etc/salt/minion  .
#ck-launch-session /usr/local/bin/startlxqt
+
#非交互
exec awesome
+
sed  's/#master: salt/master:  192.168.30.88/' -i /etc/salt/minion
export LC_ALL=zh_CN.UTF-8
+
sed  's/#master: salt/master:  172.16.200.13/' -i /etc/salt/minion
export LANGUAGE=zh_CN.UTF-8.UTF-8
+
sed 's/#id:/id: you_name/' -i /etc/salt/minion
export LANG=zh_CN.UTF-8.UTF-8
+
sed 's/#tcp_pub_port: 4510/tcp_pub_port: 4510/' -i /etc/salt/minion
fcitx &
+
sed 's/#tcp_pull_port: 4511/tcp_pull_port: 4511/' -i /etc/salt/minion
  
2019
 
  
export LC_CTYPE=“zh_CN.UTF-8” export XMODIFIERS=@im=SCIM export GTK_IM_MODULE=xim export QT_IM_DODULE=xim export XIM_PROGRAM=“scim -d” scim -d
+
systemctl restart salt-minion
 +
systemctl enable  salt-minion
  
 +
CentOS5.6配置salt节点minion
 +
http://zhoulg.blog.51cto.com/48455/1140186</pre>
  
 +
==防火墙规则 ==
 +
注意 这个才是对的 比较 安全的
 +
在主控端添加(所有 minion)TCP 4505,TCP 4506 的规则,而在被控端无须配置防火墙,原理是被控端直接与主控端的zeromp建立链接接收
  
#汉化  第一次失败了 第二再重装一下又好了 2017
+
===1.on master ===
$ vi .xinitrc
+
#salt-master服务需要监听4045和4046端口,因此需要开放这两个端口 一般加这个就行了 小伙伴今天又加反了 哈哈
export LC_ALL=zh_CN.UTF-8
+
  iptables -I INPUT -s minion_ip -p tcp -m multiport --dports 4505,4506 -j ACCEPT
export LANGUAGE=zh_CN.UTF-8.UTF-8
 
export LANG=zh_CN.UTF-8.UTF-8
 
#exec mate-session 不用这个 mate 默认没有gdm了 如果用slim 还是要用这个</pre>
 
  
http://blog.chinaunix.net/uid-20377663-id-114464.html
+
  #Allow Salt to communicate with Master on the loopback interface
 +
iptables -A INPUT -i lo -p tcp -m multiport --dports 4505,4506 -j ACCEPT
  
https://zhidao.baidu.com/question/2203007741278957948.html
+
===2.on minion===
 +
iptables -I INPUT -s 192.168.30.94 -p tcp -m multiport --dports 4510,4511 -j ACCEPT
  
https://www.cnblogs.com/misstaste/p/5177011.html
 
  
  
 
https://www.cnblogs.com/sinx/p/10585930.html
 
 
=== wifi===
 
http://www.puchalian.com/freebsd-wireless-networking-basics.html
 
 
https://www.howtoing.com/setting_up_a_freebsd_wlan_access_point/
 
 
=== update ports===
 
 
<pre>
 
<pre>
 +
#这个平时一般为了删除而查看 哈哈
 +
iptables -L -n --line-number |grep 21 # //--line-number可以显示规则序号,在删除的时候比较方
 +
iptables -D INPUT 3 # //删除input的第3条规则
 +
iptables -R INPUT 3 -j DROP # //将规则3改成DROP
  
 +
##官方的写得有点开放 不太好
 +
为SALT开启防火墙配置
 +
http://docs.saltstack.cn/topics/tutorials/firewall.html
 +
http://yango.iteye.com/blog/2264641
  
SERVERNAME=portsnap.hshh.org
+
RHEL 6 / CENTOS 6
 +
一些Linux发行版带有的``lokkit``命令行软件可以很简单的通过命令行打开iptables防火墙的端口。只是需要小心不要太粗心而关闭了ssh端口。
  
 +
lokkit范例:
 +
lokkit -p 22:tcp -p 4505:tcp -p 4506:tcp
  
http://mirrors.ustc.edu.cn/help/freebsd-ports.html
+
#iptables
 +
iptables -A INPUT -m state --state new -m tcp -p tcp --dport 4505 -j ACCEPT
 +
iptables -A INPUT -m state --state new -m tcp -p tcp --dport 4506 -j ACCEPT
  
  
 +
MASTER端白名单
  
https://www.cnblogs.com/yibinboy/articles/6136704.html
+
# Allow Minions from these networks
 +
iptables -I INPUT -s 192.168.1.0/22 -p tcp -m multiport --dports 4505,4506 -j ACCEPT
 +
-I INPUT -s 10.1.2.0/24 -p tcp -m multiport --dports 4505,4506 -j ACCEPT
 +
-I INPUT -s 10.1.3.0/24 -p tcp -m multiport --dports 4505,4506 -j ACCEPT
 +
# Allow Salt to communicate with Master on the loopback interface
 +
-A INPUT -i lo -p tcp -m multiport --dports 4505,4506 -j ACCEPT
 +
# Reject everything else
 +
-A INPUT -p tcp -m multiport --dports 4505,4506 -j REJECT</pre>
  
 +
==配置key==
 +
<pre>在master端通过salt-key -L查看Keys如下:
 +
[root@vm1 test]# salt-key -L
 +
Accepted Keys:
 +
Unaccepted Keys:
 +
test1
 +
Rejected Keys:
 +
[root@vm1 test]# salt-key -A
 +
Key for minion test1 accepted.
  
 +
[root@vm1 test]# salt 'test1' test.ping
 +
test1:
 +
True
  
 +
显示所有minion的认证信息
 +
salt-key  -L
  
pkg install firefox
+
接受所有 Unaccepted Keys 状态的minion的认证信息
</pre>
+
salt-key  -A
http://mirrors.ustc.edu.cn/help/freebsd-ports.html
 
  
https://www.cnblogs.com/yibinboy/articles/6136704.html
+
# 接受192.168.30.100的认证信息,不需要手动验证
 +
salt-key -a 192.168.30.100 -y
  
https://blog.csdn.net/lanzh_syf/article/details/86599445
 
  
===输入法===
+
# 拒绝认证192.168.0.100
==== install ====
+
salt-key -d 192.168.0.100
<pre>
 
# fcitx wubi  在xfce 是成功的
 
##记得 一定要加上chinese/ 不然是pkg 不到东西的  #fcitx-qt5 qt支持 不然在telegarm不能打字
 
pkg install chinese/fcitx  chinese/fcitx-configtool chinese/fcitx-table-extra  chinese/fcitx-ui-light fcitx-qt5
 
 
   
 
   
 +
#删除单个  有时minion 挂掉 是因为key 重名了
 +
salt-key  -d prod-web01 然后重启minion
  
</pre>
+
# 拒绝所有 Unaccepted Keys 状态的minion
 
+
salt-key -D
==== configure ====
 
<pre>
 
 
 
Note:
 
默认输入状态 非激活 不然 老是默认中文 影响 commmond
 
 
 
fcitx-diagnose  #查看相关的模块 非常不错的命令
 
 
 
vi .cshrc
 
 
 
#Note just for csh
 
setenv LANG        zh_CN.UTF-8
 
setenv LC_CTYPE    zh_CN.UTF-8
 
setenv LC_ALL      zh_CN.UTF-8
 
 
 
# evan 4 fcitx
 
setenv  XMODIFIERS @im=fcitx
 
setenv  GTK_IM_MODULE fcitx
 
setenv  QT_IM_MODULE fcitx
 
setenv  XIM=fcitx
 
 
 
 
 
下面这些只是提示而已
 
 
 
③如果使用的Shell是bash或sh:
 
cat .cshrc
 
 
 
export XMODIFIERS='@im=fcitx'
 
export GTK_IM_MODULE=fcitx
 
export QT_IM_MODULE=fcitx
 
 
 
我暂时是这个哦
 
④如果使用的Shell是csh或tcsh :
 
setenv  XMODIFIERS @im=fcitx
 
setenv  GTK_IM_MODULE fcitx
 
setenv  QT_IM_MODULE fcitx
 
⑤开机启动设置
 
系统-->首选项-->启动应用程序
 
添加fcitx
 
 
 
 
 
 
 
 
 
evan@home:~ % cat .xinitrc
 
export LC_ALL=zh_CN.UTF-8
 
export LANGUAGE=zh_CN.UTF-8.UTF-8
 
export LANG=zh_CN.UTF-8.UTF-8
 
export XMODIFIERS='@im=fcitx'
 
export GTK_IM_MODULE=fcitx
 
export GTK3_IM_MODULE=fcitx
 
 
 
mkdir -p ~/.config/autostart/
 
cp /usr/local/share/applications/fcitx.desktop    ~/.config/autostart/
 
 
 
 
 
pkg  prompt
 
Message from zh-fcitx-4.2.9.6_2:
 
 
 
************************************************************************
 
 
 
Remember to set the environment variable XMODIFIERS:
 
 
 
        csh/tcsh:      setenv XMODIFIERS @im=fcitx
 
        sh/bash:        export XMODIFIERS='@im=fcitx'
 
 
 
For GTK+ programs, you may want to set:
 
 
 
        csh/tcsh:      setenv GTK_IM_MODULE fcitx
 
                        setenv GTK3_IM_MODULE fcitx
 
        sh/bash:        export GTK_IM_MODULE=fcitx
 
                        export GTK3_IM_MODULE=fcitx
 
 
 
For Qt4 programs, we recommend you to use
 
 
 
        qtconfig-qt4: /usr/ports/misc/qt4-qtconfig
 
 
 
instead of to manually set QT4_IM_MODULE.
 
 
 
To start fcitx with your desktop, just
 
 
 
        cp /usr/local/share/applications/fcitx.desktop \
 
            ~/.config/autostart/
 
 
 
************************************************************************
 
Message from zh-fcitx-ui-light-0.1.3_2:
 
 
 
************************************************************************
 
 
 
Replace your `fcitx` command with
 
        fcitx -u fcitx-light-ui
 
to start Fcitx with this lightweight UI.
 
 
 
**************************************************************
 
 
 
 
 
</pre>
 
 
 
 
 
[[https://ultra-technology.org/freebsd/chinese-japanese-korean-input-freebsd/ Writing Chinese, Japanese, Korean in FreeBSD with fcitx]]
 
 
 
=== ops and develop  ===
 
<pre>pkg install git  rsync sudo vim bash  terminal anjuta vsftp  xfce4-terminal gcc
 
echo 'evan ALL=(ALL) NOPASSWD:NOPASSWD:ALL' >/usr/local/etc/sudoers.d/evan
 
 
 
pkg install  python
 
https://docs.python.org/2.7/using/unix.html
 
https://docs.python.org/3.3/using/unix.html
 
 
 
# python  ide
 
pkg install python  intellij-pycharm
 
ln -s /usr/local/bin/python2  /usr/bin/python
 
 
 
 
 
pkg install editors/emacs
 
https://www.freebsd.org/doc/en/books/developers-handbook/emacs.html
 
 
 
pkg install terminator
 
 
 
#dig
 
pkg  install  dns/bind-tools
 
 
 
sudo pkg install py36-pip
 
sudo pip install ipython
 
 
 
</pre>
 
 
 
====更改freebsd shell为bash vi 为vim ====
 
==== install ====
 
<pre>pkg install bash vim
 
root@home:~ # where  vi
 
/usr/bin/vi
 
 
 
mv /usr/bin/vi /usr/bin/bakvi && ln -s /usr/local/bin/vim  /usr/bin/vi</pre>
 
 
 
====设置bash====
 
<pre>evan# whereis bash
 
bash: /usr/local/bin/bash
 
 
 
#sudo mv /bin/sh /bin/bak_sh
 
 
 
##做了下面这个ln 以后我们把平时在linux下跑的 shell 脚本拿到freebsd跑,也绝大部分没问题了
 
ln -s /usr/local/bin/bash /bin/bash
 
#ln -s /usr/local/bin/bash /bin/sh
 
 
 
tcsh -s /bin/bash
 
tcsh -s /usr/local/bin/bash
 
evan# chsh -s /usr/local/bin/bash
 
chsh: user information updated
 
注销重启后 如下 搞定
 
[root@evan ~]# echo $SHELL
 
/usr/local/bin/bash
 
 
 
 
 
#anjuta log
 
===========================================================================
 
Note that some standard Python modules are provided as separate ports
 
as they require additional dependencies. They are available as:
 
 
 
py35-gdbm      databases/py35-gdbm
 
py35-sqlite3    databases/py35-sqlite3
 
py35-tkinter    x11-toolkits/py35-tkinter
 
===========================================================================
 
</pre>
 
 
 
=applications=
 
==终端==
 
<pre>
 
sudo pkg install tilda
 
</pre>
 
 
 
  
==health[[Linux 下的护眼软件]]==
 
<pre>
 
sudo pkg install  redshift
 
 
</pre>
 
</pre>
  
==rednotebook==
+
==常用命令==
 
<pre>
 
<pre>
sudo ln -s /usr/local/bin/bash /bin/bash
+
1)检查master与minion的连接状态:salt '*' test.ping or salt 'test1' test.ping
sudo pkg install py36-yaml
+
2)远程执行命令:salt '*' cmd.run 'ls /root'
 +
test1:
 +
anaconda-ks.cfg
 +
bootstrap-salt.sh
 +
install.log
 +
install.log.syslog
 +
vm2
  
sudo python3.6 setup.py install
+
3)从master上传文件至minion:
</pre>
+
salt-cp nodeid source_file target_file
https://www.freshports.org/devel/py-yaml/
+
例子:salt-cp 'vm01' /root/test/bootstrap-salt.sh /root
 +
4)master同步命令:
 +
salt '*' state.highstate
  
http://bbs.chinaunix.net/thread-3568241-1-1.html
+
To have the Minion start automatically at boot time:
 +
chkconfig salt-minion on
 +
#7
 +
systemctl enable salt-minion.service
 +
to start the Minion:
 +
#7
 +
systemctl start salt-minion.service
  
==ss==
+
https://docs.saltstack.com/en/latest/topics/installation/rhel.html
<pre>
 
ss
 
pkg install shadowsocks-libev
 
# or cd /usr/ports/net/shadowsocks-libev/ && make install clean
 
  
 +
#所有内置模块
 +
http://docs.saltstack.com/ref/modules/all/index.html
 +
http://wiki.saltstack.cn/modules/all
 +
常用内置模块
 +
[root@vm3 ~]# salt 'vm0' pkg.install w3m
 +
vm0:
 +
———-
 +
gpg-pubkey:
 +
———-
 +
new:
 +
217521f6-45e8a532,e8562897-459f07a4
 +
old:
 +
217521f6-45e8a532
 +
w3m:
 +
———-
 +
new:
 +
0.5.1-18.el5
  
</pre>
+
分组相关
[http://wiki.linuxchina.net/index.php?title=Chrome%E9%80%9A%E8%BF%87shadowsocks%E7%BF%BB%E5%A2%99#linux.28debian_pc.29_or_freebsd12 Chrome通过shadowsocks翻墙]
+
salt -N direct test.ping
 
+
salt -L sdkredis,sdklog,ad_web,inlandgw,ad_admin,da test.ping
==Document Viewers==
 
  sudo pkg install  Okular    epdfview  #Okular好用 #mupdf 只有命令行界面 # atril 好用 但是是安装上整个mate桌面
 
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/desktop-viewers.html
 
 
 
==IM==
 
 
 
===telegram===
 
  sudo pkg install telegram-desktop # 其它都不对 sudo pkg install telegram  #/usr/ports/net-im/telegram && make install clean
 
  在界面顶部的搜索框中输入@zh_CN
 
 
 
===IRC===
 
  sudo pkg install hexchat konversation
 
 
 
== 影音==
 
<pre>pkg install  celluloid  vlc audacious  multimedia/audacious-plugins archivers/unzip  mplayer  gnome-mplayer    qmmp </pre>
 
 
 
==ftp ==
 
<pre>service 自带了ftp
 
FreeBSD includes FTP server software, ftpd, in the base system.
 
https://www.freebsd.org/doc/en/books/handbook/network-ftp.html
 
#ftp client
 
pkg install filezilla
 
</pre>
 
 
 
==Browsers==
 
<pre>pkg install netsurf  midori falkon  chromium  firefox-esr#  firefox # firefox这个在配置那里就可以选择 add 中文
 
 
 
falkon
 
ld-elf.so.1: /usr/local/lib/qt5/libQt5Core.so.5: version Qt_5.13 required by /usr/local/bin/falkon not found
 
 
 
#今天 更新到firefox 70 然后起不来了 Segmentation fault (core dumped)
 
 
 
 
 
fetch https://download.cdn.mozilla.net/pub/firefox/releases/70.0/source/firefox-70.0.source.tar.xz
 
 
 
:/usr/ports/www/firefox # make install clean
 
 
 
 
 
https://www.freebsd.org/doc/handbook/desktop-browsers.html
 
 
 
## log
 
Message from chromium-56.0.2924.87_1:
 
For correct operation, shared memory support has to be enabled
 
in Chromium by performing the following command as root :
 
 
 
sysctl kern.ipc.shm_allow_removed=1
 
 
 
To preserve this setting across reboots, append the following
 
to /etc/sysctl.conf :
 
 
 
kern.ipc.shm_allow_removed=1
 
 
 
 
 
安装flashplayer插件
 
 
 
安装 nspluginwrapper  this is  only for firefox ?
 
cd /usr/ports/www/nspluginwrapper   
 
make   
 
make install
 
安装 linux-c6-flashplugin11
 
cd /usr/ports/www/linux-c6-flashplugin11 
 
make 
 
make install
 
执行nspluginwrapper -v -a -i
 
若报错Kernel too old, 执行命令sysctl compat.linux.osrelease=2.6.18
 
修改/etc/sysctl.conf, 增加compat.linux.osrelease=2.6.18
 
修改/etc/fstab
 
linproc /usr/compat/linux/proc linprocfs rw 0 0
 
 
 
 
 
 
 
#这个是 也是手册上的哦
 
cd /usr/ports/www/linux-flashplayer
 
make install clean
 
 
 
 
 
备注
 
 
 
安装步骤参考FreeBSD Handbook
 
安装nspluginwrapper会安装linux_base-c6
 
注意安装的版本</pre>
 
 
 
 
 
=== firefox ===
 
<pre>
 
要把 .mozilla/ 目录先删除 再 重装 firefox-esr 就可以同步回插件等等所有东西回来了
 
sudo pkg install firefox-esr
 
 
 
 
 
 
 
字体设置 记得这个不要勾上
 
允许页面选择自己的字体代替您的上述选择(A
 
 
 
 
 
</pre>
 
 
 
 
 
https://www.freebsd.org/doc/en/books/handbook/desktop-browsers.html
 
 
 
[https://daemon-notes.com/articles/desktop/firefox Firefox/Flash on FreeBSD]
 
 
 
==remmina==
 
<pre>
 
pkg install remmina
 
#默认没有rdp 等协议
 
To install the port: cd /usr/ports/net/remmina-plugins/ && make install clean
 
To add the package: pkg install remmina-plugins
 
</pre>
 
https://forums.freebsd.org/threads/rdp-or-vnc-for-access-to-remote-windows-machine.53651/
 
 
 
https://www.freshports.org/net/remmina-plugins/
 
 
 
==启动器==
 
synapse
 
rofi
 
 
 
https://wiki.archlinux.org/index.php/Rofi
 
 
 
https://www.cnblogs.com/siyingcheng/p/11706215.html
 
https://hacpai.com/article/1552717494529
 
 
 
https://itgoyo.github.io/2019/01/28/%E8%87%AA%E5%B7%B1%E6%8A%98%E8%85%BE%E4%B8%AARofi%E9%85%8D%E7%BD%AE/
 
 
 
https://github.com/davatorium/rofi/wiki/themes
 
 
 
==文件管理器==
 
<pre>
 
pcmanfm
 
</pre>
 
 
 
==edit==
 
<pre>
 
pkg install  gedit geany  gnote  gnome-calculator#算机器  #madedit
 
</pre>
 
 
 
==svn==
 
pkg install subversion && pkg install kdesvn  # or esvn
 
 
[[Svn基础]]
 
 
 
[https://blog.csdn.net/xujianhua815926/article/details/468811 在FreeBSD上安装SVN(Subversion)]
 
 
 
==office==
 
=== libreoffice===
 
<pre>
 
sudo pkg install libreoffice
 
pushd  /usr/ports/chinese/libreoffice-zh_CN  && sudo make  install clean
 
</pre>
 
[https://www.libreofficechina.org/ LibreOffice 中文社区]
 
 
 
==虚拟化 ==
 
<pre>#FreeBSD as a Host with VirtualBox
 
sudo pkg install emulators/virtualbox-ose
 
 
 
 
 
sudo pkg install virtualbox-ose-additions #不然没办法在freebsd12 上安装debian10.04 依然失败
 
#普通用户启动
 
sudo pw groupmod vboxusers -m evan
 
 
 
sudo sysrc vboxnet_enable
 
 
 
#现在是这样启动的
 
sudo virtualbox
 
 
  </pre>
 
  </pre>
  
===err===
+
==遇到问题==
win10  debian10 安装错误  installation step  failed
 
 
 
===note===
 
 
 
<pre>
 
=============================================================================
 
 
 
VirtualBox was installed.
 
 
 
You need to load the vboxdrv kernel module via /boot/loader.conf:
 
 
 
vboxdrv_load="YES"
 
 
 
You also have to add all users to your vboxusers group in order to use vbox.
 
 
 
% pw groupmod vboxusers -m jerry
 
 
 
Reboot the machine to load the needed kernel modules.
 
 
 
 
 
Bridging Support:
 
=================
 
 
 
For bridged networking please add the following line to your /etc/rc.conf:
 
 
 
vboxnet_enable="YES"
 
 
 
 
 
USB Support:
 
============
 
 
 
For USB support your user needs to be in the operator group and needs read
 
 
 
and write permissions to the USB device.
 
 
 
% pw groupmod operator -m jerry
 
 
 
Add the following to /etc/devfs.rules (create if it doesn't exist):
 
 
 
[system=10]
 
add path 'usb/*' mode 0660 group operator
 
 
 
To load these new rule add the following to /etc/rc.conf:
 
 
 
devfs_system_ruleset="system"
 
 
 
Then restart devfs to load the new rules:
 
 
 
% /etc/rc.d/devfs restart
 
 
 
 
 
Troubleshooting:
 
================
 
 
 
Running VirtualBox as non-root user may fail with a fatal error
 
NS_ERROR_FACTORY_NOT_REGISTERED. In this case delete /tmp/.vbox-*-ipc file.
 
If you experience "Network: write Failed: Cannot allocate memory" errors
 
try to increase net.graph.maxdata in /boot/loader.conf
 
 
 
If you are using AIO, then increase these limits (PR#168298):
 
vfs.aio.max_buf_aio=8192
 
vfs.aio.max_aio_queue_per_proc=65536
 
vfs.aio.max_aio_per_proc=8192
 
vfs.aio.max_aio_queue=65536
 
To check if AIO is used use: kldstat -v | grep aio
 
 
 
Check wiki page for known issues and troubleshooting:
 
http://wiki.freebsd.org/VirtualBox
 
 
 
Please report any problems to emulation@. Thanks!
 
 
 
</pre>
 
 
 
https://www.freebsd.org/doc/handbook/virtualization-host-virtualbox.html
 
 
 
https://wiki.freebsd.org/VirtualBox
 
 
 
[https://blog.csdn.net/flymyd/article/details/76399861 FREENAS虚拟机Jails配置全攻略(多篇集合)]
 
 
 
== 连接win客户端==
 
=== rdesktop===
 
 
<pre>
 
<pre>
pkg  -y install rdesktop
+
2017
pkg  -y install tsclient
+
[root@da ~]# /etc/init.d/salt-master restart
 
+
Stopping salt-master daemon:                              [FAILED]
rdesktop是基于命令行的工具,tsclient只是一个图形化的界面,依赖于rdesktop
+
Starting salt-master daemon: WARNING: Unable to bind socket 1.2.22.3:4505, error: [Errno 99] Cannot assign requested address; Is there another salt-master running?
</pre>
+
The salt master is shutdown. The ports are not available to bind
 
+
                                                          [FAILED]
=== remmmina===
 
== email==
 
===thunderbird===
 
<pre>
 
201912 现在 打开会100cpu
 
composition—> language —Download more  就可以下载中文了
 
 
 
Advanced  language  选择chinese
 
 
 
代理配置
 
高级 —网络 —连接
 
</pre>
 
[https://jingyan.baidu.com/article/cdddd41cac326353cb00e129.html Thunderbird设置IRC聊天]
 
 
 
[[Thunderbird]]
 
 
 
==server ==
 
===redis===
 
<pre>
 
#redis 3.x compli
 
gmaek -j2 && sudo gmake  install
 
 
 
/usr/local/bin/redis-server
 
 
 
#自启动
 
cat  /etc/rc.local
 
/usr/local/bin/redis-server > /dev/null 
 
 
 
#这个不行 Ambiguous output redirect
 
/usr/local/bin/redis-server > /dev/null  2 > &1
 
 
 
or
 
/usr/local/etc/rc.d下面放你的脚本
 
 
 
 
 
 
 
 
 
cd /usr/ports/databases/redis
 
make
 
/usr/local/etc/rc.d/redis start
 
/usr/local/bin/redis-cli
 
 
 
 
 
 
 
</pre>
 
[https://www.cnblogs.com/1q84/archive/2011/12/18/2291840.html FreeBSD下安装redis以及redis_py]
 
 
 
====docker====
 
https://wiki.freebsd.org/Docker
 
 
 
=== 参考===
 
https://www.c0ffee.net/blog/freebsd-on-a-laptop/
 
 
 
[https://feng.si/posts/2019/06/freebsd-and-risc-v-the-future-of-open-source-iot-ecosystem/ FreeBSD 与 RISC-V: 开源物联网生态系统的未来]
 
 
 
https://wiki.freebsdchina.org/software/a/awesome
 
 
 
[https://wiki.freebsdchina.org/doc/d/freebsd_desktop 使用FreeBSD作为桌面操作系统]
 
 
 
 
 
[http://bbs.chinaunix.net/thread-1780047-1-1.html FreeBSD 桌面系统常用软件清单]
 
  
[https://blog.csdn.net/u011152627/article/details/77744795 FreeBSD 配置经验]
+
打开blind ip
 +
# The address of the interface to bind to:
 +
interface: 0.0.0.0
  
[https://wiki.freebsdchina.org/doc/x/freebsd_desktop_xfce FreeBSD桌面-Xfce4]
 
  
[https://wiki.freebsdchina.org/doc/p/freebsd_desktop_kde FreeBSD 7 Xorg7.3 KDE3.5 桌面系统安装及美化]
+
问题1
 +
[root@localhost soft]# yum install python-jinja2
 +
Loaded plugins: fastestmirror, security
 +
Determining fastest mirrors
 +
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
  
[https://huataihuang.gitbooks.io/cloud-atlas/os/freebsd/ gitbooks.io freebsd]
+
编辑/etc/yum.repos.d/epel.repo和/etc/yum.repos.d/epel-testing.repo
 +
将mirrorlist注释,将baseurl打开
  
[https://www.freebsd.org/doc/en/books/developers-handbook/index.html FreeBSD Developers' Handbook]
+
问题2:
 +
file /usr/lib64/python2.6/zipfile.pyo from install of python-libs-2.6.6-64.el6.x86_64 conflicts with file from package python-2.6.6-29.el6_2.2.x86_64
 +
64 conflicts with file from package python-2.6.6-36.el6.x86_64
 +
Error Summary
  
[https://www.freebsd.org/doc/en/books/developers-handbook/emacs.html ecmacs]
+
升级下python版本
 +
yum update python or yum install python
  
[http://blog.163.com/sujoe_2006/blog/static/3353151201211431245305/ Freebsd 9.0+LXDE桌面安装]
+
问题其一
 +
minion 有这些log 加上 salt-key -L 为空
 +
017-08-04 16:35:57,645 [salt.utils.parsers            ][WARNING ][5761] Minion received a SIGTERM. Exiting.
  
 +
记录配置 master ip on master 好搞笑 各种搞错了 笨蛋
  
 +
[root@ ~]# cat  /etc/salt/minion    |  grep -v  \^# | grep -v \^$
 +
master:  10.10.1.25
 +
master_port: 4506
 +
id: ad_web
 +
tcp_pub_port: 4510
 +
tcp_pull_port: 4511
  
[https://www.cnblogs.com/yibinboy/articles/1818638.html FreeBSD笔记常用命令]
 
  
[http://www.2daygeek.com/install-xfce-mate-kde-gnome-cinnamon-desktop-environment-on-freebsd/ Choose the best Desktop for FreeBSD]
+
问题其二
 +
To repair this issue, delete the public key for this minion on the Salt Master and restart this minion.
 +
Or restart the Salt Master in open mode to clean out the keys. The Salt Minion will now exit.
  
https://cooltrainer.org/a-freebsd-desktop-howto/
+
原因:
 +
大概的意思就是,minion端拿到的key与master端的不符,验证无法通过。
 +
解决方法是删除minion端的key,再重新与master进行连接和认证。
  
 +
on master上删除key
 +
/etc/salt/pki/master/minions
  
[https://www.linuxprobe.com/remmina-linux.html 如何使用Remmina从 Linux 上连接到远程桌面]
+
如果实在不行 就把minion的也删除了
 +
解决方法是删除minion端的key,再重新与master进行连接和认证
  
 
+
minion_master.pub
[https://www.freebsdchina.org/forum/viewtopic.php?t=62967 配置FreeBSD 10.0(amd64)fvwm桌面]
 
 
 
[https://blog.csdn.net/xport/article/details/500161 安装远程桌面,VNC Server on FreeBSD + VNC Viewer on Windows ]
 
 
 
== 截图==
 
===flameshot===
 
<pre>pkg install flameshot
 
 
 
#conf
 
vi ~/.cshrc
 
alias flameshot  flameshot  gui
 
 
 
source ~/.cshrc
 
 
</pre>
 
</pre>
  
==图形==
+
==trouble shooting==
  gimp screenfetch
 
 
 
==development==
 
  
[[Eclipse]]
 
==mysql==
 
 
<pre>
 
<pre>
Message from mysql57-server-5.7.27:
+
一开始添加的是7 的源 ,导致不成功,后面一看 居然是6
*****************************************************************************
+
--> 完成依赖关系计算
 
+
错误:Package: python-babel-0.9.6-8.el7.noarch (salt-latest)
Remember to run mysql_upgrade the first time you start the MySQL server
+
          Requires: python(abi) = 2.7
after an upgrade from an earlier version.
+
          已安装: python-2.6.6-66.el6_8.x86_64 (@base)
 +
              python(abi) = 2.6
 +
          Available: python34-3.4.8-1.el6.i686 (epel)
 +
              python(abi) = 3.4
 +
错误:Package: python-msgpack-0.4.6-1.el7.x86_64 (salt-latest)
 +
          Requires: libpython2.7.so.1.0()(64bit)
  
Initial password for first time use of MySQL is saved in $HOME/.mysql_secret
 
ie. when you want to use "mysql -u root -p" first you should see password
 
in /root/.mysql_secret
 
 
MySQL57 has a default %%ETCDIR%%/my.cnf,
 
remember to replace it wit your own
 
or set `mysql_optfile="$YOUR_CNF_FILE` in rc.conf.
 
 
*****************************************************************************
 
Message from akonadi-19.04.2_1:
 
 
===============================================================================
 
 
KDE Applications versions of Akonadi, KMail, and Kontact use large
 
messages on the local machine. The default size on FreeBSD is too
 
small, which causes local connection problems, and Akonadi-based
 
applications will be flaky (e.g. mailboxes do not display, messages
 
cannot be found). Increasing the buffer size is recommended:
 
 
sysctl net.local.stream.recvspace=65536
 
sysctl net.local.stream.sendspace=65536
 
 
===============================================================================
 
  
 +
rm  /etc/yum.repos.d/salt-latest.repo
 
</pre>
 
</pre>
  
==有用的==
+
== 参考==
<pre>
+
[http://devopstarter.info/xue-xi-saltyuan-ma-zhi-hui-zhi-pythonxin-hao-liang/ 学习Salt源码智慧之Python信号量]
启用、安装linxu内核。
 
#kldload linux
 
#ee /etc/rc.conf
 
linux_enable=”YES”
 
#cd /usr/ports/www/linux_base-f10 && make install clean
 
先安装linux的flash10插件
 
cd /usr/ports/www/linux-f10-flashplugin10
 
make install clean (这一步会把libflashplayer.so安装在/usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so)
 
再安装nspluginwrapper
 
cd /usr/ports/www/nspluginwrapper
 
make install clean
 
兼容转换
 
nspluginwrapper -v -i /usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so(这一步会在/usr/local/lib/browser_plugins/ 下生成能在freebsd下使用的npwrapper.libflashplayer.so文件 )
 
最后把插件链接到chromium插件目录下
 
ln -s /usr/local/lib/browser_plugins/npwrapper.libflashplayer.so /usr/local/share/chromium/plugins/
 
与此同时firefox也可以进行视频播放了,如果还不可以,可以到网上去看看其他教程.
 
 
 
</pre>
 
==old输入法==
 
  
[https://www.xuebuyuan.com/1982862.html FreeBSD 下安装输入法]
+
[http://www.diyoms.com/automation/1690.html saltstack学习—快速安装]
 
 
[https://blog.csdn.net/cheviko/article/details/17628425 FreeBSD安装汉字输入法:SCIM]
 
 
 
[https://www.freebsdchina.org/forum/viewtopic.php?p=177278  如何配置scim(或skim)]
 
 
 
[https://wiki.archlinux.org/index.php/IBus_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) IBus (简体中文)]
 
 
 
 
 
[https://www.freshports.org/chinese/ibus-table-chinese/ ibus-table-chinese Chinese input tables for IBus]
 
 
 
==== other====
 
<pre>
 
 
 
 
 
 
 
sed -i '' -e 's/memorylocked=128M/memorylocked=256M/' /etc/login.conf
 
# cap_mkdb /etc/login.conf
 
 
 
 
 
 
 
Remember to set the environment variable XMODIFIERS:
 
 
 
csh/tcsh: setenv XMODIFIERS @im=fcitx
 
sh/bash: export XMODIFIERS='@im=fcitx'
 
 
 
For GTK+ programs, you may want to set:
 
 
 
csh/tcsh: setenv GTK_IM_MODULE fcitx
 
setenv GTK3_IM_MODULE fcitx
 
sh/bash: export GTK_IM_MODULE=fcitx
 
export GTK3_IM_MODULE=fcitx
 
 
 
 
 
 
 
 
 
 
 
 
 
For Qt4 programs, we recommend you to use
 
 
 
qtconfig-qt4: /usr/ports/misc/qt4-qtconfig
 
 
 
instead of to manually set QT4_IM_MODULE.
 
 
 
To start fcitx with your desktop, just
 
 
 
cp /usr/local/share/applications/fcitx.desktop \
 
    ~/.config/autostart/
 
 
 
************************************************************************
 
Message from zh-fcitx-ui-light-0.1.3_2:
 
 
 
************************************************************************
 
 
 
Replace your `fcitx` command with
 
fcitx -u fcitx-light-ui
 
to start Fcitx with this lightweight UI.
 
 
 
</pre>
 
<pre>0.
 
#添加到管理员组
 
pw groupmod wheel -m evan
 
 
 
#enable ssh
 
sysrc 'sshd_enable=YES'
 
 
 
 
 
cat  /etc/rc.conf
 
zfs_enable="YES"
 
hostname="digitalocean"
 
ifconfig_vtnet0="dhcp"
 
sshd_enable="YES"
 
nginx_enable="YES"
 
php_fpm_enable="YES"
 
mysql_enable="YES"
 
redis_enable="YES"
 
shadowsocks_libev_enable="YES"
 
 
 
 
 
 
 
# set time
 
ntpdate cn.pool.ntp.org
 
 
 
#添加新硬盘到 home 给evan 使用
 
 
 
 
 
 
 
</pre>
 
 
 
<pre>
 
fstab
 
evan@homebsd:~/kalibak % cat /etc/fstab
 
# Device Mountpoint FStype Options Dump Pass#
 
/dev/ada0p1 none swap sw 0 0
 
/dev/ada0p3 / ufs rw 1 1
 
/dev/ada0p4 /home ufs rw 2 2
 
proc /proc procfs rw 0 0
 
 
 
 
 
Display manager
 
https://wiki.archlinux.org/index.php/Display_manager_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
 
 
 
FreeBSD从入门到放弃
 
https://linxiaohui.gitbooks.io/notes-on-freebsd/content/
 
 
 
 
 
 
 
Tencent QQ (简体中文)
 
https://wiki.archlinux.org/index.php/Tencent_QQ_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)#.E5.9F.BA.E4.BA.8E_WebQQ
 
 
 
 
 
Installing a Desktop Environment on FreeBSD
 
https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-a-desktop-environment-on-freebsd/#!
 
 
 
 
 
How to Install FreeBSD 10.2 with Mate Desktop
 
http://linoxide.com/linux-how-to/install-freebsd-10-2-mate-desktop/
 
 
 
 
 
https://wiki.lxde.org/en/FreeBSD
 
 
 
Installing Mate desktop on FreeBSD 11
 
http://www.vpierre.it/installing-mate-desktop-on-freebsd-11/
 
 
 
fetch 获取数据
 
extract 释放全部ports
 
update 更新ports
 
第一次使用可以 portsnap fetch extract
 
以后使用可以 portsnap fetch update
 
portsnap  extract;  portsnap update
 
 
 
如果写在cron可以用 portsnap cron update
 
 
 
FreeBSD 简明用户指南
 
install gnome3  kde4 xfce etc
 
https://www.freebsd.org/doc/handbook/x11-wm.html
 
 
 
Browsers
 
https://www.freebsd.org/doc/handbook/desktop-browsers.html
 
pkg install firefox
 
pkg install swfdec-plugin
 
 
 
 
 
MP3 Audio
 
https://www.freebsd.org/doc/handbook/sound-mp3.html
 
 
 
https://bsdelf.github.io/posts/freebsd-brief-user-guide
 
 
 
https://huataihuang.gitbooks.io/cloud-atlas/content/os/freebsd/packages_and_ports.html
 
 
 
https://antumdeluge.wordpress.com/2014/07/19/how-to-install-freebsd/
 
 
 
FreeBSD简单汉化终结篇[基于core font的汉化]
 
http://bbs.watchstor.com/thread-274706-1-1.html
 
 
 
**********************
 
 
 
 
 
安装Firefox的多国语言包
 
#pkg install firefox35-i18n
 
 
 
你太善良》是香港歌手张智霖,
 
张惠妹 放开你的头脑
 
 
 
 
 
就两个文件 另外一个freebsd10 4 desktop
 
 
 
program/kindlereader
 
 
 
 
 
Official Mirrors
 
https://www.freebsd.org/doc/handbook/eresources-web.html
 
 
SERVERNAME=portsnap.FreeBSD.org
 
SERVERNAME=portsnap.cn.FreeBSD.org
 
 
 
portsnap fetch extract
 
 
 
 
 
 
 
桌面相关的官方文档
 
https://www.freebsd.org/doc/handbook/x11-wm.html
 
 
 
echo 'exec enlightenment_start'  >> ~/.xinitrc
 
 
 
##xfce  这个也是成功了 字体好看  不过是英文的呢喃 加上汉化的就行了
 
pkg install xfce
 
 
#昨天今天就是少了这一步 看来要多提高英文水平哦
 
Unlike GNOME or KDE, Xfce does not provide its own login manager. In order to start Xfce from the command line by typing startx, first add its entry to ~/.xinitrc:
 
 
 
% echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc
 
 
 
 
##gnome3
 
 
 
pkg install gnome3  vlc
 
 
 
have gdm can not add this
 
#echo 'exec gnome-session'  >> ~/.xinitrc
 
 
 
 
 
http://blog.linuxchina.net/?p=993
 
 
 
https://www.freebsd.org/doc/handbook/x11-wm.html
 
https://antumdeluge.wordpress.com/2014/07/19/how-to-install-freebsd/
 
 
 
https://forums.freebsd.org/threads/57329/
 
 
 
Installing Mate desktop on FreeBSD 11
 
http://www.vpierre.it/installing-mate-desktop-on-freebsd-11/</pre>
 
 
 
=ops=
 
在bsd上直接叫 md5  linux上是md5sum
 
https://www.freebsd.org/cgi/man.cgi?query=md5&apropos=0&sektion=0&manpath=FreeBSD+11.1-RELEASE&arch=default&format=html
 
=优化=
 
<pre>
 
 
 
sendmail_enable="NONE"
 
</pre>
 
 
 
==old ==         
 
<pre>
 
 
 
###fvwm
 
FreeBSD汉化+FVWM
 
http://zqscm.qiniucdn.com/data/20090728100241/index.html
 
 
 
1 中文环境
 
  pkg_add -r zh-auto-ch-l10n
 
  这个命令好像作了不少事情,我忘记是否下载了wenquanyi字体,没有的话,再手动来一遍
 
 pkg_add -r wqy
 
  下边的不知道是不是必须的
 
  在设置好xorg.conf中fontpath的前题下,执行
 
  fc-cache -fv,让系统加入wqy字体
 
  输入法如果没下载的话,可以
 
 pkg_add -r fcitx,我是用五笔的
 
 然后,配置中文的locale
 
 
 
 
 
  在~/.chsrc里,增加
 
 setenv LANG zh_CN.eucCN
 
  setenv LC_CTYPE zh_CN.eucCN
 
setenv LC_ALL zh_CN.eucCN
 
  上边是中文local,lc_all好像不是必须要设置的
 
 下边设置输入法
 
  setenv XMODIFIERS @im=fcitx
 
 
 
2 fvwm,这个东西小快,够用了
 
  pkg_add -r fvwm
 
 
 
3 使用fvwm作为桌面
 
  在~下,找一下有没有.xinitrc文件,没有就搞一个出来
 
  内容是
 
  exec fvwm
 
  如果要输入法也一并启动则为
 
  fcitx&
 
    exec fvwm
 
 
 
</pre>
 
 
 
=Troubleshooting=
 
<pre>
 
 
 
随便更新了一下firefox 70 现在总算可以了 以后少更新点
 
 
 
 
 
terminator 启动不了
 
Traceback (most recent call last):
 
  File "/usr/local/bin/terminator", line 83, in <module>
 
    from terminatorlib import ipc
 
  File "/usr/local/lib/python2.7/site-packages/terminatorlib/ipc.py", line 31, in <module>
 
    class DBusService(Borg, dbus.service.Object):
 
  File "/usr/local/lib/python2.7/site-packages/terminatorlib/ipc.py", line 62, in DBusService
 
    @dbus.service.method(BUS_NAME, in_signature='a{ss}')
 
  File "/usr/local/lib/python2.7/site-packages/dbus/decorators.py", line 155, in method
 
    validate_interface_name(dbus_interface)
 
ValueError: Invalid interface or error name 'net.tenshu.Terminator2-0x3bc8d9c28d7f7322': contains invalid character '-'   
 
 
 
terminator  -u  这样启动就行了
 
 
 
 
 
telegram 等等有关qt的都用不了  firefox70 也好了
 
Cannot mix incompatible Qt library (version ) with this library (version )
 
 
 
pkg install qt5-core
 
 
 
pkg update -f
 
pkg update
 
pkg upgrade
 
 
 
 
 
 
 
 
 
telegram-desktop
 
ld-elf.so.1: /usr/local/lib/qt5/libQt5Core.so.5: version Qt_5.13 required by /usr/local/bin/telegram-desktop not found
 
root@bsd-latop:~ # pkg install qt5
 
root@bsd-latop:~ # telegram-desktop
 
ld-elf.so.1: /usr/local/lib/qt5/libQt5Core.so.5: version Qt_5.13 required by /usr/local/bin/telegram-desktop not found
 
root@bsd-latop:~ # file /usr/local/lib/qt5/libQt5Core.so.5
 
/usr/local/lib/qt5/libQt5Core.so.5: symbolic link to libQt5Core.so.5.12.2
 
 
 
 
 
 
 
 
 
 
 
pkg: cached package *:size mismatch, cannot continue
 
 
 
pkg update -f
 
 
 
 
 
 
 
 
 
 
 
 
 
</pre>
 
  
https://unix.stackexchange.com/questions/384396/terminator-fails-to-start-in-i686-dbus-issue-in-python
+
[https://repo.saltstack.com/index.html 官方文档install]
  
=see also=
+
[http://debugo.com/saltstack-starter/ SaltStack之初窥门径]
  
 +
https://repo.saltstack.com/#rhel
 +
https://docs.saltstack.com/en/latest/
  
[https://linuxtoy.org/pages/download.html Linux 相关资料]
+
[http://docs.saltstack.com/topics/installation/rhel.html install]
  
[https://www.lulinux.com/archives/5557 Linux桌面常用软件列表 (2019]
+
[http://docs.saltstack.com/topics/installation/index.html 总的文档]
  
                   
+
[http://docs.saltstack.com/topics/configuration.html configure]
[https://www.cnblogs.com/dcb3688/p/4607976.html linux下几个常用软件]
 
  
 +
SaltStack installation on Centos 7
  
[https://linux.cn/article-8050-1.html 24 款必备的 Linux 桌面应用(2016 版)]
+
更加详细的配置
 +
Configuring the Salt Master
 +
http://docs.saltstack.com/ref/configuration/master.html
  
http://www.chinafreebsd.cn/article/59da3fa39561e
+
Configuring the Salt Minion
 +
http://docs.saltstack.com/ref/configuration/minion.html
  
[https://blog.csdn.net/xiao_wanpeng/article/category/1134819 csdn freebsd blog]
 
  
[http://bbs.chinaunix.net/thread-3769209-1-1.html [FreeBSD<nowiki>]</nowiki> 选择 FreeBSD 六个理由]
+
Saltstack系列3:Saltstack常用模块及API
 +
http://www.cnblogs.com/MacoLee/p/5753640.html
  
freenas Mount ext4 partition
+
CentOS7.2系统环境中安装saltstack详细配置过程讲解
http://blog.linuxchina.net/?p=1782
 
  
linux: mount UFS filesystem
+
Python自动化运维 ,这个不错,从用fabric 批量 salt开始呢
http://blog.linuxchina.net/?p=1776
+
http://opython.com/?cat=4
 +
http://blog.sina.com.cn/s/blog_7f1737720101ebzg.html
  
Linux® 用户的 FreeBSD 快速入门向导
+
深入SaltStack(转)
https://www.freebsd.org/doc/zh_CN/articles/linux-users/index.html
+
http://blog.sina.com.cn/s/blog_7f1737720101ebz9.html
  
 +
http://blog.halfss.com/blog/2013/06/15/saltxiang-guan-shi-yong/
  
https://freebsdchina.org/forum/topic_63558.html
+
Salt stack first sls 文件
 +
http://blog.csdn.net/qingchn/article/details/8752004
  
https://www.enlightenment.org/distros/freebsd-start
+
Salt实战之自动安装部署MooseFS
 +
http://blog.csdn.net/shanliangliuxing/article/details/8986731
  
https://www.freebsd.org/doc/zh_CN.UTF-8/books/handbook/updating-upgrading-portsnap.html
+
Centos 6.4安装SaltStack 有酷酷的防火墙写法
  
https://www.trueos.org/handbook/preinstall.html
+
参考资料
 +
salt的安装部署
 +
http://zhengbin.blog.51cto.com/2989505/1229884
  
[https://www.cnblogs.com/linux-xsj/p/7089069.html Linux下远程桌面连接windows]
+
salt基础命令
 +
http://zhengbin.blog.51cto.com/2989505/1229891
  
 +
salt-minion,salt-master,multi master
 +
http://www.cnblogs.com/taosim/articles/3598919.html
  
 [[category:freebsd]]
+
[[category:saltstack]]

2019年12月26日 (四) 06:17的版本

pre

master 192.168.23.50

client 192.168.20.208

 个人观点puppet最大缺点就是默认情况下Agent每隔30分钟向master同步状态,master主动推送功能比较薄弱(2.7版本),ansible基于SSH服务执行,如果服务器过多不建议使用,他是使用轮训的方式。Salt基于消息队列。性能相当好,适合大量生产环境。



SaltStack 与 Ansible 选择 SaltStack事件驱动(1) – 监视事件

第一 添加RPM源

#1.Run the following commands to install the SaltStack repository and key:
#sudo yum install https://mirrors.aliyun.com/saltstack/yum/redhat/salt-repo-latest-2.el7.noarch.rpm  -y

sudo yum install https://mirrors.aliyun.com/saltstack/yum/redhat/salt-repo-latest.el7.noarch.rpm -y #201912

sudo yum install https://mirrors.aliyun.com/saltstack/yum/redhat/salt-repo-latest-2.el6.noarch.rpm-y
#yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest-2.el6.noarch.rpm -y
#yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest-2.el7.noarch.rpm -y

#2.Run sudo yum clean expire-cache
yum clean expire-cache

#3.Install the salt-minion, salt-master, or other Salt components:
sudo yum install salt-master -y
sudo yum install salt-minion -y
sudo yum install salt-ssh -y
sudo yum install salt-syndic -y
sudo yum install salt-cloud -y
sudo yum install salt-api -y



##ios old
#7系列
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
#6系列
rpm -ivh http://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpm
#rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
#7系列
rpm -ivh http://mirrors.aliyun.com/epel/7/x86_64/e/epel-release-7-7.noarch.rpm
#5系列
wget http://mirrors.sohu.com/fedora-epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL #导入密钥
yum info salt

第二 on master

useradd salt
yum install salt-master -y

vi /etc/salt/master
# The address of the interface to bind to
interface: masterip #前面要有两个空格
# The tcp port used by the publisher
  publish_port: 4505#前面要有两个空格
#自动认证
auto_accept: True
# The user to run the salt-master as. Salt will update all permissions to
# allow the specified user to run the master. If the modified files cause
# conflicts set verify_env to False.
user: root
# interface used for the file server, authentication, job returnes, etc.
  ret_port: 4506#前面要有两个空格


systemctl restart salt-master
systemctl  enable salt-master

cat  /etc/salt/master | grep -v ^# |sort -u

#cento6
/sbin/chkconfig --add nginx
/sbin/chkconfig  --level  345 nginx  on

第三 client

useradd salt
yum install salt-minion -y

vi /etc/salt/minion #修改配置请见下面的非交互 
#编辑11行:#master: salt
master: masterip
master: 192.168.23.50

103 id: ad_admin

# Overwrite the default tcp ports used by the minion when in tcp mode
tcp_pub_port: 4510
tcp_pull_port: 4511

cp /etc/salt/minion  .
#非交互
sed  's/#master: salt/master:  192.168.30.88/' -i /etc/salt/minion 
sed  's/#master: salt/master:  172.16.200.13/' -i /etc/salt/minion 
sed 's/#id:/id: you_name/' -i /etc/salt/minion 
sed 's/#tcp_pub_port: 4510/tcp_pub_port: 4510/' -i /etc/salt/minion 
sed 's/#tcp_pull_port: 4511/tcp_pull_port: 4511/' -i /etc/salt/minion 


systemctl restart salt-minion
 systemctl enable  salt-minion

CentOS5.6配置salt节点minion
http://zhoulg.blog.51cto.com/48455/1140186

防火墙规则

注意 这个才是对的 比较 安全的 在主控端添加(所有 minion)TCP 4505,TCP 4506 的规则,而在被控端无须配置防火墙,原理是被控端直接与主控端的zeromp建立链接接收

1.on master

#salt-master服务需要监听4045和4046端口,因此需要开放这两个端口 一般加这个就行了 小伙伴今天又加反了 哈哈
iptables -I INPUT -s minion_ip -p tcp -m multiport --dports 4505,4506 -j ACCEPT
 #Allow Salt to communicate with Master on the loopback interface
iptables -A INPUT -i lo -p tcp -m multiport --dports 4505,4506 -j ACCEPT

2.on minion

iptables -I INPUT -s 192.168.30.94 -p tcp -m multiport --dports 4510,4511 -j ACCEPT


#这个平时一般为了删除而查看 哈哈
iptables -L -n --line-number |grep 21 # //--line-number可以显示规则序号,在删除的时候比较方
iptables -D INPUT 3 # //删除input的第3条规则
iptables -R INPUT 3 -j DROP # //将规则3改成DROP

##官方的写得有点开放 不太好 
为SALT开启防火墙配置
http://docs.saltstack.cn/topics/tutorials/firewall.html
http://yango.iteye.com/blog/2264641

RHEL 6 / CENTOS 6
一些Linux发行版带有的``lokkit``命令行软件可以很简单的通过命令行打开iptables防火墙的端口。只是需要小心不要太粗心而关闭了ssh端口。

lokkit范例:
lokkit -p 22:tcp -p 4505:tcp -p 4506:tcp

#iptables 
iptables -A INPUT -m state --state new -m tcp -p tcp --dport 4505 -j ACCEPT
iptables -A INPUT -m state --state new -m tcp -p tcp --dport 4506 -j ACCEPT


MASTER端白名单

# Allow Minions from these networks
iptables -I INPUT -s 192.168.1.0/22 -p tcp -m multiport --dports 4505,4506 -j ACCEPT
-I INPUT -s 10.1.2.0/24 -p tcp -m multiport --dports 4505,4506 -j ACCEPT
-I INPUT -s 10.1.3.0/24 -p tcp -m multiport --dports 4505,4506 -j ACCEPT
# Allow Salt to communicate with Master on the loopback interface
-A INPUT -i lo -p tcp -m multiport --dports 4505,4506 -j ACCEPT
# Reject everything else
-A INPUT -p tcp -m multiport --dports 4505,4506 -j REJECT

配置key

在master端通过salt-key -L查看Keys如下:
[root@vm1 test]# salt-key -L
Accepted Keys:
Unaccepted Keys:
test1
Rejected Keys:
[root@vm1 test]# salt-key -A
Key for minion test1 accepted.

[root@vm1 test]# salt 'test1' test.ping 
test1:
True

显示所有minion的认证信息
salt-key  -L

接受所有 Unaccepted Keys 状态的minion的认证信息
salt-key  -A

# 接受192.168.30.100的认证信息,不需要手动验证
salt-key -a 192.168.30.100 -y


# 拒绝认证192.168.0.100
salt-key -d 192.168.0.100
 
#删除单个  有时minion 挂掉 是因为key 重名了 
salt-key  -d prod-web01 然后重启minion

# 拒绝所有 Unaccepted Keys 状态的minion
salt-key -D

常用命令

1)检查master与minion的连接状态:salt '*' test.ping or salt 'test1' test.ping
2)远程执行命令:salt '*' cmd.run 'ls /root'
test1:
anaconda-ks.cfg
bootstrap-salt.sh
install.log
install.log.syslog
vm2

3)从master上传文件至minion:
salt-cp nodeid source_file target_file
例子:salt-cp 'vm01' /root/test/bootstrap-salt.sh /root
4)master同步命令:
salt '*' state.highstate

To have the Minion start automatically at boot time:
chkconfig salt-minion on
#7
systemctl enable salt-minion.service
to start the Minion:
#7
systemctl start salt-minion.service

https://docs.saltstack.com/en/latest/topics/installation/rhel.html

#所有内置模块
http://docs.saltstack.com/ref/modules/all/index.html
http://wiki.saltstack.cn/modules/all
常用内置模块
[root@vm3 ~]# salt 'vm0' pkg.install w3m
vm0:
———-
gpg-pubkey:
———-
new:
217521f6-45e8a532,e8562897-459f07a4
old:
217521f6-45e8a532
w3m:
———-
new:
0.5.1-18.el5

分组相关
salt -N direct  test.ping
salt -L sdkredis,sdklog,ad_web,inlandgw,ad_admin,da  test.ping
 

遇到问题

2017
[root@da ~]# /etc/init.d/salt-master restart 
Stopping salt-master daemon:                               [FAILED]
Starting salt-master daemon: WARNING: Unable to bind socket 1.2.22.3:4505, error: [Errno 99] Cannot assign requested address; Is there another salt-master running?
The salt master is shutdown. The ports are not available to bind
                                                           [FAILED]

打开blind ip 
# The address of the interface to bind to:
interface: 0.0.0.0


问题1
[root@localhost soft]# yum install python-jinja2
Loaded plugins: fastestmirror, security
Determining fastest mirrors
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

编辑/etc/yum.repos.d/epel.repo和/etc/yum.repos.d/epel-testing.repo
将mirrorlist注释,将baseurl打开

问题2:
file /usr/lib64/python2.6/zipfile.pyo from install of python-libs-2.6.6-64.el6.x86_64 conflicts with file from package python-2.6.6-29.el6_2.2.x86_64
64 conflicts with file from package python-2.6.6-36.el6.x86_64
Error Summary 

升级下python版本
yum update python or yum install python

问题其一
minion 有这些log 加上 salt-key -L 为空 
017-08-04 16:35:57,645 [salt.utils.parsers            ][WARNING ][5761] Minion received a SIGTERM. Exiting.

记录配置 master ip on master 好搞笑 各种搞错了 笨蛋

[root@ ~]# cat  /etc/salt/minion    |  grep -v   \^# | grep -v \^$
master:  10.10.1.25
master_port: 4506
id: ad_web
tcp_pub_port: 4510
tcp_pull_port: 4511


问题其二 
To repair this issue, delete the public key for this minion on the Salt Master and restart this minion.
Or restart the Salt Master in open mode to clean out the keys. The Salt Minion will now exit.

原因:
大概的意思就是,minion端拿到的key与master端的不符,验证无法通过。
解决方法是删除minion端的key,再重新与master进行连接和认证。

on master上删除key
/etc/salt/pki/master/minions

如果实在不行 就把minion的也删除了
解决方法是删除minion端的key,再重新与master进行连接和认证

minion_master.pub

trouble shooting

一开始添加的是7 的源 ,导致不成功,后面一看 居然是6
--> 完成依赖关系计算
错误:Package: python-babel-0.9.6-8.el7.noarch (salt-latest)
          Requires: python(abi) = 2.7
          已安装: python-2.6.6-66.el6_8.x86_64 (@base)
              python(abi) = 2.6
          Available: python34-3.4.8-1.el6.i686 (epel)
              python(abi) = 3.4
错误:Package: python-msgpack-0.4.6-1.el7.x86_64 (salt-latest)
          Requires: libpython2.7.so.1.0()(64bit)


rm  /etc/yum.repos.d/salt-latest.repo

参考

学习Salt源码智慧之Python信号量

saltstack学习—快速安装

官方文档install

SaltStack之初窥门径

https://repo.saltstack.com/#rhel https://docs.saltstack.com/en/latest/

install

总的文档

configure

SaltStack installation on Centos 7

更加详细的配置 Configuring the Salt Master http://docs.saltstack.com/ref/configuration/master.html

Configuring the Salt Minion http://docs.saltstack.com/ref/configuration/minion.html


Saltstack系列3:Saltstack常用模块及API http://www.cnblogs.com/MacoLee/p/5753640.html

CentOS7.2系统环境中安装saltstack详细配置过程讲解

Python自动化运维 ,这个不错,从用fabric 批量 salt开始呢 http://opython.com/?cat=4 http://blog.sina.com.cn/s/blog_7f1737720101ebzg.html

深入SaltStack(转) http://blog.sina.com.cn/s/blog_7f1737720101ebz9.html

http://blog.halfss.com/blog/2013/06/15/saltxiang-guan-shi-yong/

Salt stack first sls 文件 http://blog.csdn.net/qingchn/article/details/8752004

Salt实战之自动安装部署MooseFS http://blog.csdn.net/shanliangliuxing/article/details/8986731

Centos 6.4安装SaltStack 有酷酷的防火墙写法

参考资料 salt的安装部署 http://zhengbin.blog.51cto.com/2989505/1229884

salt基础命令 http://zhengbin.blog.51cto.com/2989505/1229891

salt-minion,salt-master,multi master http://www.cnblogs.com/taosim/articles/3598919.html