• Ubuntu18.04 Java开发环境搭建教程


    Ubuntu 18.04 教程

    1.Ubuntu 18.04 更换国内源

      国内常用的ubuntu源:中科大源,阿里源,清华源,网易源

    • 清华源
       1 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
       2 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
       3 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
       4 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
       5 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
       6 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
       7 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
       8 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
       9 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
      10 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
      清华源
    • 阿里源
      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
      阿里源
    • 网易源
      deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
      deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
      deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
      deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
      deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
      deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
      deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
      deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
      deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
      deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
      网易源
    • 中科大源
      deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
      deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
      deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
      deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
      deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
      deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
      deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
      deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
      deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
      deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
      中科大源

    此处以清华源为例:

      1. 按住Ctrl+alt+t打开命令行
      2. 输入:
        sudo gedit /etc/apt/sources.list
      3. 输入密码
      4. 将上面的源复制到文件中,并覆盖,选择一处即可
      5. 更新
        1 sudo apt-get update
        2 sudo apt-get upgrate
      6. 此处可能会报错,显示无法获得锁,注销一下再执行即可

    2.Ubuntu 18.04 Java开发环境搭建

    1. 安装jdk1.8
      1. 去官网下载1.8版本的jdk,例如我用的1.8.0_171
      2. 为避免到其他位置解压缩麻烦,建议下载后,直接在下载文件夹选中文件,右键提取到此处
      3. opt目录下新建一个environment目录,再创建一个Java子目录:
        sudo mkdir environment sudo mkdir java
      4. 移动解压缩后的jdk目录到java目录下:
        sudo mv jdk1.8.0_171 /opt/environment/java/
      5. 配置环境变量:
        sudo gedit ~/.bashrc 
      6. 然后将下面三行粘贴到文件最底部,将位置修改为自己的
        1 export JAVA_HOME=/opt/environment/jdk1.8.0_171
        2 export CLASSPATH=.:${JAVA_HOME}/lib
        3 export PATH=${JAVA_HOME}/bin:$PATH
      7. 使用java -version测试是否安装完成
    2. 安装MySQL57
      1. 此处选择后台下载方式,首先复制下列语句到终端:
        wget -b https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -o mysql-download.log
      2. 可以使用 下列语句查看下载进度:
        tail -f mysql-download.log
      3. 解压缩,并移动到指定目录,如:
        sudo mv mysql-5.7.22-linux-glibc2.12-x86_64 /opt/
      4. 创建软链接:
        sudo ln -s /opt/mysql-5.7.22-linux-glibc2.12-x86_64/ /opt/mysql
      5. 安装依赖:
        1 sudo apt-cache search libaio
        2 sudo apt-get install libaio1
      6. 建立用户组:
        1 sudo groupadd mysql
        2 sudo useradd -r -g mysql -s /bin/false mysql
      7. 创建服务端配置文件:
         1 cat > /opt/mysql/etc/my.cnf <<CNF
         2 [mysqld]
         3 basedir=/opt/mysql
         4 datadir=/data/mysql
         5 port=3306
         6 socket=/data/mysql/mysql.sock
         7 max_connections=260
         8 pid-file=/data/mysql/mysql.pid
         9 log-error=/data/mysql/error.log
        10 CNF
      8. 初始化数据目录:
        1 sudo /opt/mysql/bin/mysqld ---defaults-file=/opt/mysql/etc/my.cnf --user=mysql –initialize-in
        2 SQL> alter user root@localhost identified by '1';
      9. 启动musql:
        sudo /opt/mysql/bin/mysqld --defaults-file=/opt/mysql/etc/my.cnf --user=mysql 2>&1 &
      10. 创建客户端配置文件:
        1 cat >~/.my.cnf <<EOF
        2 [client]user=root
        3 password=1
        4 #在 /opt/mysql/etc/my.cnf 中有配置。用于本机进程通信
        5 socket=/data/mysql/mysql.sock
        6 EOF
      11. 注:因为我本人安装MySQL的时候网上并没有系统的关于ubuntu18.04的教程,所以当时安装的不是很顺利,最后没办法,把压缩包解压后,一个一个点击安装的,此处教程转自博客园网友ChaseForFuture原文地址
    3. 安装eclipse
      1. 安装eclipse相对简单,到eclipse官网下载最新的eclipse 4.7.3a的安装包,然后解压缩
      2. 移动到/opt 目录下即可,但是每次使用都需要进入eclipse的bin目录太麻烦,建议手工配置桌面快捷方式
      3. 步骤如下:
        1. 打开终端,输入sudo gedit /usr/share/applications/eclipse.desktop
        2. 将下面的这段代码复制进去:
           1 [Desktop Entry]
           2 
           3 Encoding=UTF-8
           4 
           5 Name=Eclipse
           6 
           7 Comment=Eclipse
           8 
           9 #将下面这行改成自己的安装位置,最后一个eclipse不要擅自去掉,linux下eclipse的可运行文件没有后缀名
          10 
          11 Exec=/opt/software/eclipse-jee-oxygen-3a-linux-gtk-x86_64/eclipse/eclipse
          12 
          13 Icon=/opt/software/eclipse-jee-oxygen-3a-linux-gtk-x86_64/eclipse/icon.xpm
          14 
          15 Terminal=false
          16 
          17 StartupNotify=true
          18 
          19 Type=Application
          20 
          21 Categories=Application;Development
          eclipse
    1. 安装idea
      1. 安装idea教程和上面安装eclipse差不多
      2. 如果需要破解的话,到http://idea.lanyus.com/下载破解补丁,然后打开安装目录下bin目录,粘贴
      3. 找到idea64.vmoptionsidea.vmoptions,使用gedit或者vim打开,在最底下加上如下代码:
        -javaagent:/opt/software/ideaIU-2018.1.2/idea-IU-181.4668.68/bin/JetbrainsCrack-2.7-release-str.jar
      4. 冒号后面的地址指向破解补丁对应的地址
      5. 创建快捷方式或者使用sh idea.sh 命令打开idea,选择第二种验证方式,验证代码可以随意输入
      6. 创建快捷方式和上面步骤相同,也略有不同,如下:
         1 [Desktop Entry]
         2 Encoding=UTF-8
         3 Name=IntelliJ IDEA
         4 Comment=IntelliJ IDEA
         5 #因为idea在linux下的可运行文件是.sh方式,所以配置稍有不同
         6 Exec=sh /opt/software/ideaIU-2018.1.2/idea-IU-181.4668.68/bin/idea.sh
         7 Icon=/opt/software/ideaIU-2018.1.2/idea-IU-181.4668.68/bin/idea.png
         8 Terminal=false
         9 Type=Application
        10 Categories=Developer;
        11 Name[zh_CN]=IDEA
        idea快捷方式
    2. 安装maven
      1. 解压缩并移动到自定义的目录
      2. 配置环境变量,如上配置jdk,使用:
        sudo gedit ~/.bashrc 
      3.  添加如下代码:
        1 export M2_HOME=/opt/environment/maven/apache-maven-3.5.3-bin/apache-maven-3.5.3
        2 export PATH=${M2_HOME}/bin:$PATH
      4. 使用mvn -v 验证安装是否成功
    3. 安装git
      1. 至于git,安装很简单:
        sudo apt-get install git
      2. 使用方式我就懒得放了,写了一下午,脖子酸  

    3.Ubuntu18.04 搜狗输入法安装教程

    ubuntu18.04,因为依赖原因造成搜狗输入法安装失败,或者安装后无法启动等问题。

      1. 首先,到搜狗官网下载最新的deb安装文件
      2. 然后使用命令行安装依赖:sudo apt install libfcitx-qt0
      3. 在文件下载目录创建一个新的临时文件夹:mkdir temp
      4. 接着将deb安装文件解压到temp文件夹中:dpkg-deb -R sogoupinyin_2.2.0.0102_amd64.deb temp/
      5. 使用gedit编辑器编辑 temp/DEBIAN/control gedit temp/DEBIAN/control
      6. 找到fcitx-libs-qt (>= 4.2.7),将之替换成libfcitx-qt0 (>= 1:4.2.9.6-1)
      7. temp同级目录下创建新的build文件夹
      8. 重新封包:dpkg-deb -b temp/ build/
      9. 双击deb安装文件进行安装或者使用 dekg -i sogoupinyin_2.2.0.0102_amd64.deb
      10. 解决依赖问题:sudo apt install –fix-broken
      11. 将键盘输入法系统设置位fcitx,重启系统,将输入法设置成zh

        

  • 相关阅读:
    Qt中修改QtoolTip的样式
    字符编码笔记:ASCII、Unicode和UTF-8
    UML类图关系模式(C++代码说明)
    sql标签和include标签的使用
    mybatis动态SQL标签的用法
    <!CDATA[ ....... ]] > 用法详解
    Mybatis 中$与#的区别
    枚举
    ExtJs如何判断form表单是否被修改过详解
    Extjs二级联动combo省城市
  • 原文地址:https://www.cnblogs.com/lxc-2017/p/8991693.html
Copyright © 2020-2023  润新知