更新源
18.04
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
17.10
cd /etc/apt/
sudo cp sources.list sources.list.bak
sudo vi sources.list
把下面的这些源添加到source.list文件头部:
# aliyun
deb http://mirrors.aliyun.com/ubuntu/ artful main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ artful-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ artful-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ artful-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ artful-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ artful main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ artful-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ artful-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ artful-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ artful-backports main restricted universe multiverse
最后更新源和更新已安装的包:
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
17.04
# aliyun
deb http://mirrors.aliyun.com/ubuntu/ zesty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ zesty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ zesty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ zesty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ zesty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ zesty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ zesty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ zesty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ zesty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ zesty-backports main restricted universe multiverse
# 163
deb http://mirrors.163.com/ubuntu/ zesty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ zesty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ zesty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ zesty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ zesty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ zesty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ zesty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ zesty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ zesty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ zesty-backports main restricted universe multiverse
# sohu
deb http://mirrors.sohu.com/ubuntu/ zesty main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ zesty-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ zesty-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ zesty-proposed main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ zesty-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ zesty main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ zesty-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ zesty-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ zesty-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ zesty-backports main restricted universe multiverse
gnome-tweak-tool
sudo apt install gnome-tweak-tool
隐藏GNOME status bar
安装步骤:
mkdir ~/.local/share/gnome-shell/extensions/
cd ~/.local/share/gnome-shell/extensions/
git clone https://github.com/mlutfy/hidetopbar.git hidetopbar@mathieu.bidon.ca
cd hidetopbar@mathieu.bidon.ca
make schemas
gnome-shell-extension-tool -e hidetopbar@mathieu.bidon.ca
gnome-shell --replace &
参考
There is a fantastic extension for that: https://extensions.gnome.org/extension/545/hide-top-bar/
Here is an ubuntu guide for extensions: http://www.omgubuntu.co.uk/2017/01/install-gnome-shell-extensions-firefox-chrome
安装chrome
sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources.list.d/
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt-get update
sudo apt-get install google-chrome-stable
安装微信
下载地址:
https://github.com/geeeeeeeeek/electronic-wechat/releases
安装Oracle Java
添加PPA:
sudo add-apt-repository ppa:webupd8team/java
更新软件包列表:
sudo apt-get update
安装Oracle Java,使用下面特别的包安装,会把它设置为默认的JRE。在安装过程中需要接受协议:
sudo apt-get install oracle-java8-set-default
安装完,确认Java版本:
java -version
安装输入法
打开终端输入下面的命令
sudo apt-get install fcitx fcitx-googlepinyin im-config
然后在终端中输入下面的命令打开输入法配置
im-config
点击OK按钮,再点击Yes按钮,将fcitx设为默认的输入法框架,最后点击OK。
然后重启系统。在桌面右上角你会发现ibus的En图标不见了,fcitx的键盘图标会出现。
点击fcitx的键盘图标,选择text entry settings
在打开的窗口中点击**+号**
然后在文本框中输入pinyin查找谷歌拼音输入法,将其添加到输入法列表中。如果查找不到,重启系统后再试一次。
安装GTX1080显卡驱动
安装 Nvidia 驱动 381.65,先添加源
sudo add-apt-repository ppa:graphics-drivers/ppa
第一次运行出现警告,回车后继续:
sudo apt-get update
sudo apt-get install nvidia-381
sudo apt-get install mesa-common-dev
sudo apt-get install freeglut3-dev
之后重启系统让GTX1080显卡驱动生效。
安装CUDA参考原文
* 注意:在虚拟机下安装驱动可能造成无法登陆。参考:
https://wyldeplayground.net/ubuntu-15-10-login-loop-after-nvidia-install-for-all-users/
https://askubuntu.com/questions/614128/15-04-and-nvidia-login-loop
安装Docker
实际上是docker.io
sudo apt install docker.io
装完后验证一下(一定要sudo,否则可能报错docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?):
sudo docker run hello-world
如果不行,尝试重启服务:
sudo service docker start
安装rabbitmq
docker运行
安装rabbitmq:
sudo docker run -d -p 15672:15672 -p 5672:5672 rabbitmq
会自动下载镜像,并运行。然后查看containerId:
sudo docker ps
启动以后设置参数:
sudo docker exec -it $containerId bash
rabbitmqctl add_user usrname pwd
rabbitmqctl set_user_tags usrname administrator
rabbitmqctl add_vhost vhostname
rabbitmqctl set_permissions -p usrname vhostname ".*" ".*" ".*"
rabbitmq-plugins enable rabbitmq_management
本地运行
sudo apt-get install rabbitmq-server
sudo rabbitmq-plugins enable rabbitmq_management #启用管理插件
service rabbitmq-server stop
service rabbitmq-server restart
download http://localhost:15672/cli/
sudo mv rabbitmqadmin /usr/local/bin/rabbitmqadmin
chmod
chown
chgrp
sudo sh -c 'rabbitmqadmin --bash-completion > /etc/bash_completion.d/rabbitmqadmin' #开启自动补全
WebUI http://localhost:15672/api/
sudo rabbitmqctl add_user user_name pwd
rabbitmqctl set_permissions -p /exchange_path user_name ".*" ".*" ".*"
sudo rabbitmqctl list_users
sudo rabbitmqctl add_vhost hostname
sudo rabbitmqctl list_vhosts
rabbitmqadmin -V hostname list exchanges
安装ssh远程登录
在服务器上安装ssh服务
sudo apt-get install openssh-server
查看ssh服务是否启动
sudo ps -e |grep ssh
有sshd,说明ssh服务已经启动,如果没有启动,输入:
sudo service ssh start
修改配置
sudo gedit /etc/ssh/sshd_config
把的"PermitRootLogin without-password"注释掉,再增加一句"PermitRootLogin yes"
#PermitRootLogin without-password
PermitRootLogin yes
ssh 登录缓慢
输入用户名后要等好一阵先出现提示输入密码, 这是Ubuntu默认开启了 SSH 的 DNS反解析造成的原因,只要将此选项关闭, 重新启动sshd后反应非常快。
vi /etc/ssh/sshd_config
在最后添加下面一行,关闭 SSH 的 DNS 反解析:
UseDNS no
然后重启sshd
sudo service ssh restart
UseDNS选项打开状态下,当客户端试图登录OpenSSH服务器时,服务器端先根据客户端的IP地址进行DNS PTR反向查询,查询出客户端的host name,然后根据查询出的客户端host name进行DNS 正向A记录查询,验证与其原始IP地址是否一致,这是防止客户端欺骗的一种手段,但一般我们的IP是动态的,不会有PTR记录的,打开这个选项不过是在白白浪费时间而已。
使用SSH免密码登陆
从Client机器上远程登陆Server机器。登陆方式采用RSA密钥免密码登陆方式。
1.安装ssh服务
在Ubuntu服务器上安装ssh:
apt-get install ssh
安装完成后验证是否SSH安装成功,结果显示ssh版本证明成功:
ssh -V
2.查看Server端home目录下是否存在隐藏目录".ssh",若不存在,新建一个.ssh目录
3.Client端生成公钥和密钥:
ssh-keygen
4.将Client端的公钥添加到用于认证的Server端的公钥文件中
先检查.ssh目录下是否存在一个名为“authorized_keys”的文件,若不存在先创建一个:
touch authorized_keys
创建完成后,将Clinet端公钥的内容复制到 authorized_keys 文件中,保存文件,更改 authorized_keys 文件的权限(一定要修改authorized_keys文件的权限为600,否则认证会失败):
chmod 600 authorized_keys
Client公钥内容格式大概如下:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzKGjCrHNCPCT96TTl8j1UtJ10V9a3fLIdx6R0upKP2N7FJP82Nni/vmAx7UVDhUNCgyfyG5Y6wK8AK2hOGjKLfLdfyYPojwmx3MF8KTspZBmmYKbHWh6Aem4TskRmsHOSpWeqns7o3tle0Ln1GMmPpdFph/owa7vj5/JYSOCBX8c+gGFyJeAMHGTs1fnHhGZRl5mzu8mWIv+qJnDxRmE/jBtuNXzSrPeZ2Cz86U+DfWtXVRyEl9XoIotX+GZ/zPxvPoMoItWD3UL6aA8McCX/PE7BLFA4B1Nl+mefTVpHH39AqcyqkcAJxntoqeNU3IwaM7sx/J7ONrFxp9Z3fjVR phenix@Client
5.验证无密码登陆
在Client端命令行执行如下命令:
ssh -p12 user@10.2.31.33 (本例ssh服务开在了12端口,默认为22)
直接登陆至Server端,表示验证成功。
注意:Server端需要开启SSH服务,不然客户端使用ssh连接不上(步骤见前文)
安装OrientDB
docker运行
sudo docker run -d --name orientdb -p 2424:2424 -p 2480:2480 -e ORIENTDB_ROOT_PASSWORD=root orientdb:latest
本地运行
下载最新的OrientDB,比如版本2.2.10
wget https://orientdb.com/download.php?file=orientdb-community-2.2.10.tar.gz
下载的tar包中包含编译好的OrientDB,你只需要把它解压的适当的位置即可,我把它放到/opt目录下:
sudo tar -xf download.php?file=orientdb-community-2.2.10.tar.gz -C /opt
解压后它的名称为orientdb-community-2.1.10,改为orientdb:
sudo mv /opt/orientdb-community-2.2.10 /opt/orientdb
进入安装完成的目录,启动orientdb服务:
cd /opt/orientdb
sudo bin/server.sh
在第一启动时需要为root用户设置密码。输出如下:
这个服务监听两个端口2424(binary连接)和2480(HTTP连接),使用如下命令查询:
sudo netstat -plunt | grep 2424
# tcp6 0 0 :::2424 :::* LISTEN 2674/java
sudo netstat -plunt | grep 2480
# tcp6 0 0 :::2480 :::* LISTEN 2674/java
连接到数据库(终端)
$ sudo /opt/orientdb/bin/console.sh
OrientDB console v.2.1.8 (build 2.1.x@r; 2015-12-17 11:51:38+0100) www.orientdb.com
Type 'help' to display all the supported commands.
Installing extensions for GREMLIN language v.2.6.0
orientdb>
登陆root用户:
orientdb> connect remote:127.0.0.1 root passwd
Connecting to remote Server instance [remote:127.0.0.1] with user 'root'...OK
orientdb {server=remote:127.0.0.1/}>
退出:
orientdb {server=remote:127.0.0.1/}> exit
最后记得把db库链接到自己的库路径:
sudo rm -r /opt/orientdb/databases
sudo ln -s ~/workspace/data/orientdb/ /opt/orientdb/databases
安装mongodb
17.04
---------------------------------------------------------------------------
sudo apt install mongodb
备份恢复db:
mongodump -h host_ip -d db_name -o /home/user/tmp
mongorestore /home/user/tmp/db
14.04
---------------------------------------------------------------------------
1.导入软件源的公钥
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
2.为MongoDB创建软件源list文件
ubuntu12.04
echo "deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
ubuntu14.04
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
ubuntu16.04
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
3.更新软件源并安装mongodb
sudo apt-get update
sudo apt-get install -y mongodb-org
如果想要安装特定的版本,使用下面命令:
sudo apt-get install -y mongodb-org=3.2.9 mongodb-org-server=3.2.9 mongodb-org-shell=3.2.9 mongodb-org-mongos=3.2.9 mongodb-org-tools=3.2.9
4.启动、重启和关闭命令
sudo service mongod start sudo service mongod restart sudo service mongod stop
5.mongodb的完全卸载
先停止运行mongodb
sudo service mongod stop
再卸载软件
sudo apt-get purge mongodb-org*
删除数据库和日志文件
sudo rm -r /var/log/mongodb sudo rm -r /var/lib/mongodb
安装Scala
Java
sudo apt-get update sudo apt-get install default-jdk
Scala
sudo apt-get remove scala-library scala sudo wget http://scala-lang.org/files/archive/scala-2.12.3-1.deb sudo dpkg -i scala-2.12.1.deb sudo apt-get update sudo apt-get install scala
SBT
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 sudo apt-get update sudo apt-get install sbt
安装gradle
官网下载最新版, 解压, 再设置环境变量
/etc/profile
export GRADLE_HOME=/opt/gradle-4.4.1
export PATH=$GRADLE_HOME/bin:$PATH
或者:
curl -s "https://get.sdkman.io" | bash
sdk install gradle 4.1
安装Zeal
sudo apt-get install zeal
安装WPS
到wps官网下载安装包:
wget http://kdl.cc.ksosoft.com/wps-community/download/a21/wps-office\_10.1.0.5672~a21\_amd64.deb
cd 到安装包的目录 执行
sudo dpkg -i wps-office_10.1.0.5672~a21_amd64.deb
在安装的过程中会提示安装失败, 失败原因是缺少libpng12-0 依赖。下载该依赖的地址是:
http://packages.ubuntu.com/zh-cn/xenial/amd64/libpng12-0/download
下载后执行下面命令安装
sudo dpkg -i libpng12-0_1.2.54-1ubuntu1_amd64.deb
然后在重新安装wps
sudo dpkg -i wps-office_10.1.0.5672~a21_amd64.deb
启动WPS for Linux后,出现提示"系统缺失字体" 。
出现提示的原因是因为WPS for Linux没有自带windows的字体,只要在Linux系统中加载字体即可。
具体操作步骤如下:
1. 下载缺失的字体文件,然后复制到Linux系统中的/usr/share/fonts文件夹中。
国外下载地址:https://www.dropbox.com/s/lfy4hvq95ilwyw5/wps\_symbol\_fonts.zip
国内下载地址:https://pan.baidu.com/s/1eS6xIzo
下载完成后,解压并进入目录中,继续执行:
sudo cp * /usr/share/fonts
2. 执行以下命令,生成字体的索引信息:
sudo mkfontscale
sudo mkfontdir
3. 运行fc-cache命令更新字体缓存。
sudo fc-cache
4. 重启wps即可,字体缺失的提示不再出现。
环境配置
sudo vi ~/.bashrc
在最后添加:
alias orientserver='cd /opt/orientdb/bin;./server.sh'
alias orientdb='cd /opt/orientdb/bin/;./console.sh'
alias idea='cd /opt/idea/bin;nohup ./idea.sh &'
alias robomongo='cd /opt/robomongo/bin;nohup ./robomongo &'
保存后source:
source ~/.bashrc
下载工具aria2
aira2是一个命令行下载工具,可以配合其他图形界面的下载软件使用。我用的是uget+aria2。uget本身是一个小巧实用的多线程下载工具,加上aria2作为插件,下载速度有明显提高。
一、安装。
uget和aria2都可以在“软件中心”中安装,但是版本太老啦,无法发挥作用,所以最好还是在终端中添加ppa进行安装:
1.uget的安装:
sudo add-apt-repository ppa:plushuang-tw/uget-stable
sudo apt-get update
sudo apt-get install uget
2.aria2的安装:
sudo add-apt-repository ppa:t-tujikawa/ppa
sudo apt-get update
sudo apt-get install aria2
安装完aria2后,可以在终端中运行aria2 -v,查看版本和支持的特性。需要1.10以上的版本才能支持资源搜索。
二、设置
1.主界面及版本
2.启用aria2插件
3.设置下载任务的属性(同时下载几个任务、多少个服务器、保存位置等)
服务器数设置为16比较合适
安装Terminator
旧版有UI bug,这里选择安装nightly版本
https://launchpad.net/~gnome-terminator/+archive/ubuntu/nightly-gtk3?field.series_filter=zesty
sudo add-apt-repository ppa:gnome-terminator/nightly-gtk3 sudo apt-get update sudo apt-get install terminator
修改窗口默认大小
cd ~/.config/terminator/
vi config
添加size,如下:
[global_config]
focus = system
suppress_multiple_term_dialog = True
tab_position = bottom
title_transmit_bg_color = "#d30102"
[keybindings]
[layouts]
[[default]]
[[[child1]]]
parent = window0
profile = default
type = Terminal
[[[window0]]]
parent = ""
size = 1440, 900
type = Window
[plugins]
[profiles]
[[default]]
copy_on_selection = True
cursor_color = "#aaaaaa"
scrollback_lines = 10000
show_titlebar = False
然后把缓冲区大小设大一点
Nodepadqq
对于Ubuntu发行版本可以通过PPA安装,命令如下:
sudo add-apt-repository ppa:notepadqq-team/notepadqq
sudo apt-get update
sudo apt-get install notepadqq
类似的,卸载命令如下:
sudo apt-get remove notepadqq
sudo add-apt-repository --remove ppa:notepadqq-team/notepadqq
/END/