ubuntu16/18

Posted wljcom

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu16/18相关的知识,希望对你有一定的参考价值。

sudo lsb_release -a
cat /etc/issue

ls -al /bin/sh
# choose [No] to use bash
sudo dpkg-reconfigure dash

sudo apt-get install ssh openssh-server ssh-import-id lzop
sudo apt-get purge libreoffice?
sudo apt-get remove --purge libreoffice*
sudo apt-get purge openjdk*
sudo apt-get remove libreoffice-common unity-webapps-common thunderbird totem rhythmbox empathy brasero simple-scan gnome-mahjongg aisleriot gnome-mines cheese transmission-common gnome-orca webbrowser-app gnome-sudoku  landscape-client-ui-install onboard deja-dup  
sudo apt-get install vim vim-gnome vim-addon-manager vim-scripts exuberant-ctags ctags

# Ubuntu 编译环境错误小结
sudo apt-get install lzop
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
sudo apt-get install bison
sudo apt-get install libxml2-utils

# Ubuntu 16.04 TLS完美编译android 6.0.1系统
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo apt-get install git-core gnupg flex bison gperf build-essential
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache
libgl1-mesa-dev libxml2-utils xsltproc unzip

sudo apt-get install g++
sudo apt-get install gperf
sudo apt-get install flex
sudo apt-get install bison
sudo apt-get install libswitch-perl  
sudo apt-get install libxml2-utils

# Ubuntu 16.04 编译Android 4.4
sudo apt-get install -y git lzop libswitch-perl flex bison gperf build-essential libncurses5-dev:i386 libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 dpkg-dev libsdl1.2-dev libesd0-dev git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4

// miui  Ubuntu 14.04  http://forum.xda-developers.com/android/software/guide-build-port-miui-rom-to-device-t3250984
sudo apt-get install openjdk-7-jdk openjdk-7-jre
sudo apt-get install bison build-essential curl flex git git-core gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev unzip lib32readline-gplv2-dev lib32z1-dev make python-networkx zlib1g-dev:i386 phablet-tools

sudo apt-get clean      #删除所有已下载的包文件
sudo apt-get autoclean  #删除已下载的旧包文件
sudo apt-get autoremove #卸载所有自动安装且不再使用的软件包
sudo apt-get update     #取回更新的软件包列表信息
sudo apt-get upgrade    #*** 补丁升级

//gitolite
sudo apt-get install git openssh-server openssh-client  
    sudo adduser --system --shell /bin/bash --gecos ‘Git SCM User‘ --group --disabled-password --home /home/git git  
sudo userdel -r git
sudo useradd --system --shell /bin/bash --create-home git
sudo passwd git  
sudo su git
git clone http://github.com/sitaramc/gitolite
[email protected]:~$ mkdir -p ${HOME}/bin  
[email protected]:~$ ${HOME}/gitolite/install -to ${HOME}/bin  
[email protected]:~$ ${HOME}/bin/gitolite setup -pk /tmp/zk.pub  
git clone ssh://[email protected]:52198/gitolite-admin.git
    
repo    gntv/..*
        C       =    id_rsa wlj lq fdd pu vm-centos mini
        RW+CD     =    id_rsa wlj lq fdd pu vm-centos mini

vim .profile
# set PATH so it includes user‘s private bin if it exists
if [ -d "$HOME/repo-bin" ] ; then
    PATH="$HOME/repo-bin:$PATH"
fi
        
Can‘t exec "libtoolize" on Ubuntu
sudo apt-get install aptitude  
sudo aptitude install libtool  
    
sudo vim /etc/network/interfaces  
auto ens33  
#iface ens33 inet dhcp
iface ens33 inet static
address 192.168.36.58
netmask 255.255.255.0
gateway 192.168.36.1
dns-nameservers 202.98.96.68  
dns-nameservers 223.5.5.5

auto eno1
iface eno1 inet static
address 192.168.36.36
netmask 255.255.255.0
gateway 192.168.36.1
dns-nameservers 202.98.96.68  
dns-nameservers 223.5.5.5

auto eno1
iface eno1 inet static
address 192.168.152.36
netmask 255.255.255.0
gateway 192.168.152.1
dns-nameservers 202.98.96.68  
dns-nameservers 223.5.5.5

// 如下设置好使
sudo vim /etc/resolvconf/resolv.conf.d/base
nameserver 223.5.5.5
nameserver 202.99.96.68
sudo resolvconf -u

sudo vim /etc/resolv.conf
nameserver 223.5.5.5

sudo /etc/init.d/networking restart

sudo vim /etc/NetworkManager/NetworkManager.conf
打开该文件,将“managed=false”修改为“managed=true”。
sudo service network-manager restart

// 编译ffmpeg
sudo apt-get install -y yasm
// 编译vlc
sudo apt-get install -y automake ant autopoint cmake build-essential libtool
     patch pkg-config protobuf-compiler ragel subversion unzip git libc6-i386
// android sdk需要
sudo apt-get install -y libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1 linux-libc-dev:i386
sudo apt-get install -y zlib1g:i386 libstdc++6:i386 libc6:i386 lib32ncurses5 lib32z1 ibnss3-tools
sudo apt-get install -y yasm automake ant autopoint cmake build-essential libtool patch pkg-config protobuf-compiler ragel subversion unzip git libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1 linux-libc-dev:i386

// privoxy
sudo apt-get install privoxy
sudo vim /etc/privoxy/config
forward-socks4a / 192.168.152.18:7070 .
listen-address 192.168.152.8:3128
sudo /etc/init.d/privoxy restart
sudo update-rc.d privoxy enable
sudo update-rc.d privoxy defaults

sudo update-rc.d apache2 defaults
sudo update-rc.d nginx defaults
sudo update-rc.d redis_6379 defaults
sudo update-rc.d -f apache2 remove
sudo update-rc.d -f nginx remove
sudo update-rc.d -f redis_6379 remove
sudo /etc/init.d/apache2 stop
sudo update-rc.d apache2 enable

// unity 图标位置
gsettings set com.canonical.Unity.Launcher launcher-position Bottom
gsettings set com.canonical.Unity.Launcher launcher-position Left


sudo apt-get install ssh
vim ~/.ssh/ssh_config
sudo vim /etc/ssh/ssh_config
#GSSAPIAuthentication yes
#GSSAPIDelegateCredentials no
TCPKeepAlive yes
ServerAliveInterval 60
ServerAliveCountMax 6

sudo vim /etc/ssh/sshd_config    
//在sshd_config末尾处插入如下行
TCPKeepAlive yes
ClientAliveInterval 60
ClientAliveCountMax 6
UseDNS no
PermitRootLogin yes

sudo service ssh restart

ssh -o TCPKeepAlive=yes -o ServerAliveInterval=60 [email protected] -p 12345678

// samba 配置
sudo apt-get install -y git automake autoconf samba smbclient samba-common minicom python-glade2 system-config-samba nfs-kernel-server nfs-common

sudo smbpasswd -a wlj   
sudo vim /etc/samba/smb.conf
[wljhome]
    comment = wljhome
    path = /home/wlj
    writeable = yes
;   browseable = yes
    valid users = wlj
    
sudo service smbd restart

// 禁用guest用户
sudo vim /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
allow-guest=false


vim .bashrc
export ANDROID_HOME=/home/wlj/android-sdk
export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools

vim /etc/profile
export JAVA_HOME=/opt/jdk
export JAVA_FONTS=$JAVA_HOME/jre/lib/fonts
export JRE_HOME=$JAVA_HOME/jre
export JAVA_PATH=$JAVA_HOME/bin:$JRE_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_PATH:$PATH


sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java/bin/java 300   
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java/bin/javac 300    
sudo update-alternatives --config java

export JAVA_HOME=/usr/jdk1.8.0_101
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_60/bin/java 300  
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_60/bin/javac 300  
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.7.0_60/bin/jar 300   
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk1.7.0_60/bin/javah 300   
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.7.0_60/bin/javap 300   
然后执行:
sudo update-alternatives --config java



sudo update-java-alternatives -s java-7-oracle
sudo update-java-alternatives -s java-8-oracle




$ sudo vim /etc/default/locale
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"    
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
sudo locale-gen en_US.UTF-8
sudo update-locale LANG=en_US.UTF-8

sudo locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales
sudo update-locale LANG=en_US.UTF-8
sudo update-locale LANG="en_US" LANGUAGE="en_US.UTF-8"


# 更新 protobuf
说明[https://github.com/google/protobuf/blob/master/src/README.md]
./autogen.sh  然后
./configure
make
make check
sudo make install
sudo ldconfig

sudo apt update
sudo apt list --upgradable


第一步:安装aptitude下载工具。
sudo apt-get install aptitude
第二步:指定版本安装,遇到y/n按y。
sudo aptitude install make=3.8.1

由于ubuntu16.04自带make版本过高,无法编译。因此需要将make降至3.81或3.82版本
下载地址ftp://ftp.gnu.org/gnu/make/
下载后到Downloads下将文件拷到其他目录(home下即可),然后解压
    tar -zxvf make3.8.2.tar.gz
解压后进入到make3.8.2的目录下
    ./configure
    make
    sudo make install
执行完后在/usr/local/bin中可得到新版本的make,复制到/usr/bin中即可
注:make过程中可能会出现错误,不用理会,只要make install能够成功执行即可。

安装make v3.81
Installing GNU Make (use only make-3.81; this was designed for android)
$ wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
$ tar -xvzf make-3.81.tar.gz
$ cd make-3.81
$ ./configure
$ sudo make install



PPA方式:
1、如果你在 Ubuntu 软件中心安装过 OpenJDK,请先使用如下命令将其删除:
sudo apt-get purge openjdk*
2、添加 PPA 源
sudo add-apt-repository ppa:webupd8team/java
3、更新下源数据库
sudo apt-get update
4、安装 Oracle Java 8
sudo apt-get install oracle-java8-installer
5、查看版本:
java -version
6、设置 Java 8 环境变量:
sudo apt-get install oracle-java8-set-default
7、java版本切换
sudo update-java-alternatives -s java-8-oracle
8、卸载jdk
sudo apt-get remove oracle-java8-installer



step 1:插入移动硬盘,然后输入命令 sudo fdisk -l
可看到所有硬盘信息和分区信息,如:
我的是 /dev/sdb1   *        2048   976769023   488383488    7  HPFS/NTFS/exFAT
step 2 挂载
先在服务器建立一个文件夹 sudo mkdir /media/disk
然后把移动硬盘挂载在这个文件夹上sudo mount -o rw /dev/sdb1 /media/disk
step3 复制
cp -r /xxx /media/disk

sudo umount -f /media/disk
sudo udisks --detach /dev/sdb1
sudo eject /dev/sdb1

sudo udisksctl unmount -b /dev/sdb1
udisksctl power-off -b /dev/sdb





























































































































































































































































































































以上是关于ubuntu16/18的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu 16.04/18.04 安装Pycharm及Ipython等

Ubuntu 16.04/18.04 右键创建新建文件

ubuntu 14.04/16.04/18.04 yum安装 zabbix-agent 教程

Ubuntu 16.04/18.04 安装Shutter截图工具

ubuntu16.04 18.04 Qt5.11安装Gstreamer

Ubuntu16.0(18.04)安装php(7.0 7.1 7.3.7.4)