Linux下wget下載軟件小技巧以及安裝jdk、tomcat與ftp服務器


一。ftp的安裝

裝個ftp搞了一下午,感覺以前沒那么麻煩的呀,結果到晚上才發現是實驗室網的問題,換連手機的熱點馬上可以了,真是尷尬,把基本安裝步驟記錄一下:

  • 1、檢查安裝vsftpd軟件

    使用如下命令#rpm -qa |grep vsftpd可以檢測出是否安裝了vsftpd軟件,

    如果沒有安裝,使用YUM命令進行安裝。

     
  • 2、啟動服務 

    使用vsftpd軟件,主要包括如下幾個命令:

    啟動ftp命令#service vsftpd start

    停止ftp命令#service vsftpd stop

    重啟ftp命令#service vsftpd restart

     
  • 3、vsftpd的配置

    ftp的配置文件主要有三個,位於/etc/vsftpd/目錄下,分別是:

    ftpusers    該文件用來指定那些用戶不能訪問ftp服務器。

    user_list   該文件用來指示的默認賬戶在默認情況下也不能訪問ftp

    vsftpd.conf   vsftpd的主配置文件

  • 4、以匿名用戶為例,我們去掉配置文件vsftpd.conf 里面以下

    anon_upload_enable=YES

    anon_mkdir_write_enable=YES

    兩項前面的#號,就可以完成匿名用戶的配置,此時匿名用戶既可以登錄上傳、下載文件。記得修改配置文件后需要重啟服務。

     
     
  • 5、非匿名賬戶的創建與使用

    vsftpd服務與系統用戶是相互關聯的,例如我們創建一個名為test 的系統用戶,那么此用戶在默認配置的情況下就可以實現登錄,如圖

     
     
  • 登錄后在頁面創建名為“aa”的文件夾,同樣我們在服務器test用戶 的home目錄里也可以看到相同的文件。

     

二。jdk的安裝與wget小技巧

本來以為在centos下(其他Linux也行,ubantu不用這么麻煩)用wget直接加下載地址就可以下載想要的軟件,沒想到有的鏈接做了封裝,具體細節不清楚,所以有些鏈接直接復制進去不行,下載下來的是亂七八糟的文檔,例如oracle的jdk。

后來找到了解決方法,如下:

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz

把后面的鏈接改為你要下載的文件的版本。即可。

三。配置

[root@bogon jre]# rpm -qa|grep jdk java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64 java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64 java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64 java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64

卸載命令

[root@bogon jre]# yum -y remove java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64

卸載完成之后Java命令不被識別

[root@bogon lib]# java -version bash: java: command not found...

下載好之后把文件移動到/usr/lib/jvm下(習慣),然后進行解壓:

解壓到安裝目錄

[root@bogon software]# tar -zxvf jdk-8u101-linux-x64.tar.gz -C /usr/local/java/

安裝完畢之后在/etc/profile文件末尾添加

[root@bogon software]# vim /etc/profile export JAVA_HOME=/usr/local/java/jdk1.8.0_101 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH

使/etc/profile生效

[root@bogon jdk1.8.0_101]# source /etc/profile


檢測安裝是否成功

[root@bogon jdk1.8.0_101]# java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
[root@bogon jdk1.8.0_101]# javac
Usage: javac <options> <source files>
where possible options include:
  -g Generate all debugging info -g:none Generate no debugging info -g:{lines,vars,source} Generate only some debugging info -nowarn Generate no warnings -verbose Output messages about what the compiler is doing -deprecation Output source locations where deprecated APIs are used -classpath <path> Specify where to find user class files and annotation processors -cp <path> Specify where to find user class files and annotation processors -sourcepath <path> Specify where to find input source files -bootclasspath <path> Override location of bootstrap class files -extdirs <dirs> Override location of installed extensions -endorseddirs <dirs> Override location of endorsed standards path -proc:{none,only} Control whether annotation processing and/or compilation is done. -processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process -processorpath <path> Specify where to find annotation processors -parameters Generate metadata for reflection on method parameters -d <directory> Specify where to place generated class files -s <directory> Specify where to place generated source files -h <directory> Specify where to place generated native header files -implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files -encoding <encoding> Specify character encoding used by source files -source <release> Provide source compatibility with specified release -target <release> Generate class files for specific VM version -profile <profile> Check that API used is available in the specified profile -version Version information -help Print a synopsis of standard options -Akey[=value] Options to pass to annotation processors -X Print a synopsis of nonstandard options -J<flag> Pass <flag> directly to the runtime system -Werror Terminate compilation if warnings occur @<filename> Read options and filenames from file

四。tomcat的安裝

直接用wget +tomcat的官方鏡像網站就可以下載,把下載好的文件移動到/usr/local目錄下。進入其中的bin目錄 運行./startup.sh即可。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM