Ubuntu18.04 装机配置~待续
这里把一些初始化安装配置记录一下。
更换阿里云软件源
// 备份初始软件源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
//编辑软件源列表
sudo gedit /etc/apt/sources.list
// 删除sources.list里面所有东西,放入以下内容
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
// 终端输入
sudo apt update
// 更新,这一命令会更新内核,最好只在刚装上系统时运行一次
sudo apt upgrade
安装软件和小工具,常用配置
安装VScode Chrome 输入法 网易云音乐 VirtualBox
设置 root 密码
sudo passwd root
顶栏显示内存
sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor
sudo apt update
sudo apt install indicator-sysmonitor
indicator-sysmonitor &
文件夹右键管理员身份打开
sudo apt install nautilus-admin
// 重启 nautilus
nautilus -q
优化
sudo apt install gnome-tweak-tools gnome-shell-extension-dashtodock
安装OpenCV
依赖
sudo apt install build-essential libgtk2.0-dev libvtk6-dev libjpeg-dev libtiff5-dev libopenexr-dev libtbb-dev
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgtk-3-dev
安装Ceres
依赖
sudo apt install liblapack-dev libsuitesparse-dev libcxsparse3 libgflags-dev libgoogle-glog-dev libgtest-dev
安装g2o
依赖
sudo apt install libqglviewer-dev-qt5 libsuitesparse-dev libcxsparse3 libcholmod3
安装Nvidia显卡驱动
1.添加 nvidia ppa 源
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
2.禁用 nouveau
sudo gedit /etc/modprobe.d/blacklist-nouveau.conf
// 在文件里写入
blacklist nouveau
options nouveau modeset=0
// 更新
sudo update-initramfs -u
禁用nouveau后重启大概率黑屏,在grub界面按e进入编辑模式,在quite splash 后 加上 nomodeset 参数,局部看起来像这样
quite splash nomodeset
F10 保存启动,启动后 shell 查看 nouveau 是否禁用成功,没有输出则禁用成功,没有消息就是好消息(斜眼笑)。
lsmod | grep nouveau
之后在软件更新里安装显卡驱动。
安装 ROS
添加源
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
添加密钥
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
安装
sudo apt update
sudo apt install ros-melodic-desktop-full
sudo apt install ros-melodic-rqt*
rosdep初始化
由于国内rosdep被墙了,这里用小鱼大神修改的rosdep
sudo pip install rosdepc
// 或者
sudo pip3 install rosdepc
sudo rosdepc init
rosdepc update
装ros-install
sudo apt-get install python-rosinstall
装moveit!
sudo apt install ros-melodic-moveit
装手柄控制
最好用罗技手柄
sudo apt install ros-melodic-joystick-drivers ros-melodic-joy
sudo apt install joystick
载入环境
// bash
source /opt/ros/melodic/setup.bash
// zsh
source /opt/ros/melodic/setup.zsh
// 放在 ~/.bashrc 的末尾可以使每次打开命令行不用source
gedit ~/.bashrc
海龟测试
打开三个终端分别运行
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
安装 zsh 和 on my zsh
sudo apt install zsh git
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
// 镜像
git clone https://ghproxy.com/https://github.com/robbyrussell/oh-my-zsh ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
chsh -s /usr/bin/zsh
安装 zsh 插件并更换 ys 主题
zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
// 镜像
git clone https://ghproxy.com/https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
// 镜像
git clone https://ghproxy.com/https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
修改~/.zshrc配置文件
gedit ~/.zshrc
plugins=(git
extract
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source $ZSH_CUSTOM/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /opt/ros/melodic/setup.zsh