将python脚本添加为centos7服务

树莓派上做的ddns要自启动

sudo  vim /usr/lib/systemd/system/myddns.service  

#这里myservice.service可以定义为自己想要取的名字。

[Unit]
Description=myddns Service
After=multi-user.target
[Service]
Type=idle
ExecStart=/usr/bin/python2.7   /root/hwx_aliyun_ddns/DDNS.py
[Install]
WantedBy=multi-user.target

更改文件权限

sudo chmod 644 /usr/lib/systemd/system/myddns.service
使配置文件生效
sudo systemctl daemon-reload     #重载服务列表
sudo systemctl enable myddns.service  #设置开机自启动
sudo systemctl start  myddns.service    #开启服务
sudo systemctl  status  myddns.service   #查看服务是否正常运行

或者重启查看能否自启动。
reboot

image.png

centos7 设置固定ip

目前的eth0地址:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.101.104  netmask 255.255.255.0  broadcast 192.168.101.255
        inet6 fe80::5099:46ff:fe57:603e  prefixlen 64  scopeid 0x20<link>
        ether 52:99:46:57:60:3e  txqueuelen 1000  (Ethernet)
        RX packets 267860  bytes 295712013 (282.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 233105  bytes 26260005 (25.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

编辑eth0的文件

vi /etc/sysconfig/network-scripts/ifcfg-eth0

修改前

image.png

修改后

NAME=eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
NM_CONTROLLED=yes
IPADDR=192.168.101.104
NETMASK=255.255.255.0
GATEWAY=192.168.101.255

树莓派centos7安装shadowsocket

安装ss

pip install shadowsocks

创建配置文件 /etc/shadowsocks.json

{
        "server": "0.0.0.0",
        "server_port": 12000,
        "local_address": "127.0.0.1",
        "local_port": 12000,
        "password": "yourpassword",
        "timeout": 300,
        "method": "aes-256-cfb",
        "fast_open": true,
        "workers": 1
}

配置自启动

[Unit]

Description=Shadowsocks


[Service]

TimeoutStartSec=0

ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json

执行以下命令启动 shadowsocks 服务:

systemctl enable shadowsocks
 
systemctl start shadowsocks

systemctl status shadowsocks -l

最后要检查一下端口(12000)是否开放 要不然没办法使用代理

[Standard_init_linux.go:190: exec user process caused “exec format error]

You have to run the docker image that was built for a particular Architecture on a docker node that is running that same Architecture.

Take docker out of the picture for a moment. You can’t run a Linux application compiled and built on a Linux ARM machine and run it on a Linux amd64 machine. You can’t run a Linux application compiled and built on a Linux Power machine on a Linux amd64 machine.

I answered this same issue/question in this another post.
Take a look -> How much does Docker virtualize? 367

https://forums.docker.com/t/standard-init-linux-go-190-exec-user-process-caused-exec-format-error/49368/5