ubuntu16.04服务器

1.用ultraiso刻录ubuntu-16.04-amd64
2.安装(最好不用uefi)
3.配置网络,关闭ipv6,配置ip/gateway/dns,在/etc/fstab里面增加一行:
/dev/sda2 /home ext4 defaults 0 1
安装ssh服务器
apt-get install openssh-server


4./etc/apt/sources.list把光盘去掉,添加163的源,用默认的源也不错
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse


apt-get purge libappstream3
apt-get update


5.配置sudo,先安装
apt-get install sudo
然后在/etc/sudoers里面添加:
wyt ALL=(ALL) NOPASSWD:ALL


6.配置samba
sudo apt-get install samba
/etc/samba/smb.conf配置:
[wyt]
path = /home/wyt
valid users = wyt
available = yes
public = no
writable = yes
read only = no
然后
/etc/init.d/samba restart


7.配置nfs
apt-get install nfs-common nfs-kernel-server
编辑/etc/exports
/home *(rw,sync,no_root_squash,no_all_squash)
然后
/etc/init.d/nfs-kernel-server restart
挂载:
mount -t nfs -o nolock,vers=3 192.168.8.163:/home/wyt /mnt


8.配置ssh
修改/etc/ssh/sshd_config,添加一行:
UseDNS yes


9.安装32位库
dpkg --add-architecture i386
apt-get update
apt-get install -y libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1
dpkg --remove-architecture i386
apt-get update


10.安装docker
参考:https://docs.docker.com/engine/installation/linux/docker-ce/debian/
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 -
验证:apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
验证:查看/etc/apt/sources.list
apt-get update
apt-get install docker-ce
docker run hello-world
usermod -aG docker wyt 运行完了用户要注销一下
后面安装的镜像都是在hub.docker.com搜索到的


11.用docker安装mongodb(使用代理参考博客)
sudo apt install openssl
sudo apt install libssl-dev
cd /lib/x86_64-linux-gnu
sudo ln -s libssl.so.1.0.0 libssl.so.10
sudo ln -s libcrypto.so.1.0.0 libcrypto.so.10


12.用docker安装nginx
docker pull nginx
docker run -d --name mynginx1 --restart=on-failure:100 -p 65000:80 -v /home/wyt/web:/usr/share/nginx/html nginx
docker cp mynginx1:/etc/nginx/nginx.conf ~/nginx.conf
然后编辑nginx.conf,在gzip on附近加上几行:
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
再执行
docker cp ~/nginx.conf mynginx1:/etc/nginx/nginx.conf
docker restart mynginx1


13.用docker安装gogs
docker run -d --name=mygogs1 --restart=on-failure:100 -p 22072:22 -p 65099:3000 -v /home/wyt/bin/.my_gogs:/data gogs/gogs
docker run -d --name=sjzd_gogs --restart=on-failure:100 -p 22973:22 -p 65065:3000 -v /home/root/sjzd_gogs:/data gogs/gogs


14.创建文件/etc/rc.local,用chmod 777 设置权限,文件内容:
#!/bin/bash
date >> /home/root/bootinfo.txt
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
service docker start
sleep 3
docker start mynginx1
docker start mymongo1
docker start sjzd_gogs
docker start mygogs1
exit
node /home/wyt/mysource/goNewsSpider-Node.js/tests/web_service.js &


15.安装node及设置taobao镜像
tar Jxf node-v6.11.2-linux-x64.tar.xz
sudo ln -s /home/wyt/bin/node-v6.11.2-linux-x64/bin/node /usr/local/bin/node
sudo ln -s /home/wyt/bin/node-v6.11.2-linux-x64/bin/npm /usr/local/bin/npm
sudo ln -s /home/wyt/bin/node-v6.11.2-linux-x64/bin/nrm /usr/local/bin/nrm
再执行:
npm install --registry=https://registry.npm.taobao.org
用这个来切换源:
npm install -g nrm
nrm list


16.安装tftp
apt-get install tftpd tftp openbsd-inetd
修改/etc/inetd.conf,把/srv/tftp改为/home/wyt/tftp
/etc/init.d/openbsd-inetd restart


17.nvidia显卡导致出现‘NMI watchdog: BUG: soft lockup’无法启动
进入grub,然后按e进入编辑模式在quiet后面加nomodeset,会以这个临时参数进入linux,
在里面编辑/etc/default/grub
在GRUB_CMDLINE_LINUX_DEFAULT最后加入nomodeset,即:
GRUB_CMDLINE_LINUX_DEFAULT="quiet nomodeset"
然后update-grub


18.安装tensorflow
rm /usr/bin/python
ln -s /usr/bin/python3.5 /usr/bin/python
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip install tensorflow
pip install tensorflow-gpu
pip uninstall xxx
GPU版本安装,先安装nvidia驱动,然后cuda,然后cudnn:
lspci
nvidia-smi
python> import tensorflow as tf


19.安装远程桌面(会引起gdm3不稳定,不建议安装)
dpkg -i nomachine_5.3.10_6_amd64.deb
默认端口是4000,添加iptables端口映射(不建议修改/usr/NX/etc/server.cfg):
iptables -t nat -A PREROUTING -p tcp --dport 64321 -j REDIRECT --to-port 4000


20.其它包安装
apt-get insall net-tools 这个装了才有ifconfig,据说ifconfig要被废弃,新的命令是ip
docker run -d -p 10086:10086 -v /var/run/docker.sock:/var/run/docker.sock tobegit3hub/seagull
docker pull gcc:4.9.4
docker pull redis
docker pull elasticsearch
docker pull postgres
docker pull logstash
docker pull httpd
docker pull php
docker pull jira
docker pull redmine
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值