cndaqiang / E5-PC-daily

服务器集群管理遇到的问题和总结
1 stars 0 forks source link

No个人数据中心-Minit #14

Open cndaqiang opened 4 years ago

cndaqiang commented 4 years ago

把之前的笔记本改造成数据中心,用于运行docker,git服务器,云盘等

cndaqiang commented 4 years ago
apt-get install openssh-server
cndaqiang commented 4 years ago

打印机共享 CUPS

安装

sudo apt-get install cups

127.0.0.1:631登陆 修改右边的配置文件后就可以了 image

也可以修改配置文件/etc/cups/cupsd.conf 其中的一些设置

WebInterface Yes
<Location />
  # Allow remote access...
  Order allow,deny
  Allow all
</Location>
<Location /admin>
  Allow 192.168.1.*
</Location>
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
</Location>

windows添加 jiu就是cups网页上相应打印机的详情页 image

cndaqiang commented 4 years ago

安装docker

sudo apt-get remove docker docker-engine docker.io
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

添加

sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

实际上识别的是错误的

cat /etc/os-release
NAME="Linux Mint"
VERSION="19 (Tara)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 19"
VERSION_ID="19"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.ubuntu.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=tara
UBUNTU_CODENAME=bionic

可以看到是bionic 修改/etc/apt/sources.list.d/additional-repositories.list中的tara为bionic即可

deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu    bionic    stable

安装

sudo apt-get update
sudo apt-get install docker-ce
oem@girl:~$ docker -v
Docker version 19.03.2, build 6a30dfc

需改docker容器镜像存放位置

移动/var/lib/docker 并建立软连接

cndaqiang commented 4 years ago

docker运行百度云

docker pull johnshine/baidunetdisk-crossover-vnc

运行

docker run -d -p 本地端口:5901 -v 本地路径:容器路径-crossover-vnc:latest
如
docker run -d -p 5901:5901 -v /home/data/public/yundocker:/mnt/drive_d johnshine/baidunetdisk-crossover-vnc:latest

然后使用vnc客户端连接ip:5901即可 登陆百度云设置下载地址为容器地址,此处/mnt/drive_d即可 image

 关闭容器

docker container start/stop container_ID 

image

cndaqiang commented 4 years ago

ubunutu安装aftp,为mac提供timemachine备份磁盘

参考 通过afp从Mac连接到ubuntu共享文件

sudo apt-get install netatalk

配置文件

sudo vim /etc/default/netatalk

取消下面的注释

ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no

添加共享目录,如/home/data

sudo vim /etc/netatalk/AppleVolumes.default

/home/data/public/timemachine "timegirl" options:tm

必须加上 options:tm 不然不能挂载到timemachine

重启

sudo systemctl restart netatalk

mac连接

afp://192.168.1.2

image

cndaqiang commented 4 years ago

draft

php5.6

docker pull php:5.6-fpm
droot=$PWD
www=$droot/www
docker run -dti --name  php56 -p 670:80 -v $www:/www   php:5.6-fpm
cndaqiang commented 4 years ago

关闭ufw

apt-get remove ufw
iptables -P INPUT ACCEPT
iptables -F  
#认规则**若未`iptables -P INPUT ACCEPT`, 会清空默认的ssh**
#清空所有自定义规则
iptables -X
iptables -Z
iptables -A INPUT -i lo -j ACCEPT
iptables -I INPUT -s 10.0.0.0/8  -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
#开放21端口(FTP)
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
#开放80端口(HTTP)
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
#开放443端口(HTTPS)
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
#允许ping
iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT
iptables -A INPUT -p tcp --dport 680 -j ACCEPT
iptables -A INPUT -p tcp --dport 688 -j ACCEPT
iptables -A INPUT -p tcp --dport 622 -j ACCEPT
iptables -A INPUT -p tcp --dport 2022 -j ACCEPT
#打开通往docker网段的防火墙
iptables -A INPUT -d 172.17.0.0/16 -j ACCEPT
#就可以把防火墙的其他端口默认关闭了
iptables -A INPUT -j DROP
#iptables -P INPUT DROP 
#所有出站一律绿灯
iptables -P OUTPUT ACCEPT
#所有转发接受,不让,docker的转发,不能访问
#iptables -P FORWARD DROP
iptables -nvL
sudo netfilter-persistent save
sudo netfilter-persistent reload

iptables的初次配置会清空docker的配置,会报错

ocker: Error response from daemon: driver failed programming external connectivity on endpoint tdpwInit2 (18fec4ba66dcf2e545e5bf67df5b3c3aa
 (exit status 1)).

重启docker

systemctl restart docker
cndaqiang commented 4 years ago
docker run -i -t -p 2022:22  -v /home/public/docker/tdpwGO/home:/home  --name tdpwInit centos:7.6.1810
cndaqiang commented 4 years ago
yum install passwd openssh-server gcc gcc-gfortran gcc-c++  which  ncurses  make  rsync wget openmpi openmpi-devel
 ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
 ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
 ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
 ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
#修改配置 63行
vi /etc/ssh/sshd_config
#取消注释
PasswordAuthentication yes
PermitRootLogin yes

PermitRootLogin yes

cndaqiang commented 4 years ago
 yum -y install libxml2-devel openssl-devel gcc gcc-c++ boost-devel libtool
cndaqiang commented 4 years ago
docker commit -m "tdpw init" -a cndaqiang 723c1ed591b0 tdpwinit

docker run -i -t -d -p 2022:22   --restart always -v /home/public/docker/tdpwGO/home:/home    --name tdpwGo -h "tdpwGo" tdpwinit /usr/sbin/sshd -D
docker exec  -it  tdpwGo bash
adduser --home /home/tdpw tdpw
passwd tdpw 
#密码 password
#sudo
 yum install sudo
usermod -aG wheel tdpw
for i in pbs_server pbs_sched pbs_mom trqauthd ; do service $i start; done
for i in pbs_server pbs_sched pbs_mom trqauthd ; do service $i status; done

rm -f /var/lock/subsys/pbs_mom rm /var/spool/torque/mom_priv/mom.lock

gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
[root@tdpwGo /]# !cat
cat /proc/version
Linux version 4.15.0-20-generic (buildd@lgw01-amd64-039) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018
[root@tdpwGo /]# exit
exit
root@mommint:/home/cndaqiang# cat /proc/version
Linux version 4.15.0-20-generic (buildd@lgw01-amd64-039) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018

严重怀疑ubuntu下的docker受ubuntu的影响,也不能安装pbs

cndaqiang commented 4 years ago

chrome被hao123劫持 image

cndaqiang commented 4 years ago

mint 安装cuda

image

http://www.booksword.info/2018/07/14/cuda-9-2-installation-on-Linux-mint-19/