日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

【Linux 操作系统】阿里云服务器 操作实战 部署C语言开发环境(vim配置,gcc) 部署J2EE网站(jdk,tomcat)

發布時間:2025/6/17 linux 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【Linux 操作系统】阿里云服务器 操作实战 部署C语言开发环境(vim配置,gcc) 部署J2EE网站(jdk,tomcat) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

.

作者?:萬境絕塵?

轉載請注明出處?:?http://blog.csdn.net/shulianghan/article/details/18964835

.


博客總結 : 設置SecureCRT顯示行數 : 會話選項 -> 終端 -> 仿真 -> 回滾(回滾緩沖區) 設置一個NNNN值.





在公司呆久了, 感覺全身都生銹了, 突然心血來潮, 準備自己用java寫一個網站.

選來選去, 最終感覺阿里云的服務器性價比蠻高的, 買了一個最便宜的配置用來學習用.

在家里配置了一下, 到了公司又不會配置了, 怕忘了寫篇博客記錄下來, 一通配置下來, 發現自己有運維工程師的潛質.?


一. 配置服務器


1. 阿里云服務器相關的信息


阿里云會發一個短信到手機上, 上面有服務器的公網ip, root用戶的用戶名和密碼.

先買一個月試用一下.



服務器還沒有啟用, 統計數據基本沒啥用.




20G的磁盤




2. 使用SecureCRT終端連接


(1) 連接服務器








此時進入了終端, 界面比較戳 :?




(2) 配置界面?


選項 -> 會話選項 進行如下配置 :


?


配置完之后的界面 :?




界面看起來帥氣多了.



3. 使用xftp上傳文件


打開xftp之后就會彈出下面的對話框, 選擇 New 按鈕;


在這個界面配置連接服務器的參數, 注意要選擇SFTP協議, 因為阿里云服務器默認選擇沒有安裝FTP, 只能使用SFTP協議連接;


點擊確定之后, 就會創建這個連接;


選擇想要的連接, 點擊connect按鈕, 就可以連接到服務器上了.

root目錄 :?




根目錄 :

?



上傳一個文件示例 :?





二. 配置C語言開發環境


1. 安裝gcc


(1) 配置yum源


yum安裝gcc很容易, 使用 yum -y install gcc 命令, 就可以安裝gcc編譯器, 但是除了一點問題:


yum命令 : 說明安裝了yum




yum -y install gcc 命令 安裝gcc編譯器 : 安裝失敗, 是因為沒有安裝yum源.




阿里云的服務器上安裝了yum, 但是沒有配置yum源, 這讓人很郁悶, 尤其像我這種運維小白, 查資料吧, 終與搞定了;


yum源在 etc/yum.conf 文件中進行配置 :?


阿里云服務器中的 yum.conf :?

[main] cachedir=/var/cache/yum keepcache=0 debuglevel=2 logfile=/var/log/yum.log distroverpkg=redhat-release tolerant=1 exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 exclude=*.i?86 kernel kernel-xen kernel-debug# Note: yum-RHN-plugin doesn't honor this. metadata_expire=1h# Default. # installonly_limit = 3# PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d
顯然里面沒有配置yum源, 需要在后面加上下面的內容 :?


[base] name=CentOS-5 - Base baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5[update] name=CentOS-5 - Updates baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5[addons] name=CentOS-5 - Addons baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5[extras] name=CentOS-5 - Extras baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5[centosplus] name=CentOS-5 - Plus baseurl=http://ftp.sjtu.edu.cn/centos/5/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5#contrib - packages by Centos Users [contrib] name=CentOS-5 - Contrib baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/ gpgcheck=1 enabled=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5[dag] name=Dag RPM Repository for RHEL5 baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
將yum源追加到 etc/yum.conf 配置文件中即可.?


(2) GPG keys 錯誤


由于yum安裝了不同版本的 GPG keys, 會出現下面的錯誤 :?

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897


此時解決方法 : 執行?rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 命令 即可解決該問題;


(3) 安裝gcc編譯器


執行 yum -y install gcc 命令, 即可成功安裝gcc編譯器.


[root@AY13120614215362640bZ ~]# yum -y install gcc addons | 1.9 kB 00:00 base | 1.1 kB 00:00 contrib | 1.9 kB 00:00 dag | 1.9 kB 00:00 extras | 2.1 kB 00:00 update | 1.9 kB 00:00 Excluding Packages in global exclude list Finished Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package gcc.x86_64 0:4.1.2-54.el5 set to be updated --> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================================Package Arch Version Repository Size ============================================================================================================================================================= Installing:gcc x86_64 4.1.2-54.el5 base 5.3 MTransaction Summary ============================================================================================================================================================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 5.3 M Downloading Packages: gcc-4.1.2-54.el5.x86_64.rpm | 5.3 MB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running TransactionInstalling : gcc 1/1 Installed:gcc.x86_64 0:4.1.2-54.el5 Complete!
驗證gcc安裝成功 : 輸入 gcc --help 命令


[root@AY13120614215362640bZ ~]# gcc --help Usage: gcc [options] file... Options:-pass-exit-codes Exit with highest error code from a phase--help Display this information--target-help Display target specific command line options(Use '-v --help' to display command line options of sub-processes)-dumpspecs Display all of the built in spec strings-dumpversion Display the version of the compiler-dumpmachine Display the compiler's target processor-print-search-dirs Display the directories in the compiler's search path-print-libgcc-file-name Display the name of the compiler's companion library-print-file-name=<lib> Display the full path to library <lib>-print-prog-name=<prog> Display the full path to compiler component <prog>-print-multi-directory Display the root directory for versions of libgcc-print-multi-lib Display the mapping between command line options andmultiple library search directories-print-multi-os-directory Display the relative path to OS libraries-Wa,<options> Pass comma-separated <options> on to the assembler-Wp,<options> Pass comma-separated <options> on to the preprocessor-Wl,<options> Pass comma-separated <options> on to the linker-Xassembler <arg> Pass <arg> on to the assembler-Xpreprocessor <arg> Pass <arg> on to the preprocessor-Xlinker <arg> Pass <arg> on to the linker-combine Pass multiple source files to compiler at once-save-temps Do not delete intermediate files-pipe Use pipes rather than intermediate files-time Time the execution of each subprocess-specs=<file> Override built-in specs with the contents of <file>-std=<standard> Assume that the input sources are for <standard>--sysroot=<directory> Use <directory> as the root directory for headersfor headers and libraries-B <directory> Add <directory> to the compiler's search paths-b <machine> Run gcc for target <machine>, if installed-V <version> Run gcc version number <version>, if installed-v Display the programs invoked by the compiler-### Like -v but options quoted and commands not executed-E Preprocess only; do not compile, assemble or link-S Compile only; do not assemble or link-c Compile and assemble, but do not link-o <file> Place the output into <file>-x <language> Specify the language of the following input filesPermissible languages include: c c++ assembler none'none' means revert to the default behavior ofguessing the language based on the file's extensionOptions starting with -g, -f, -m, -O, -W, or --param are automaticallypassed on to the various sub-processes invoked by gcc. In order to passother options on to these processes the -W<letter> options must be used.For bug reporting instructions, please see: <URL:http://bugzilla.redhat.com/bugzilla>.

2. 配置vim編輯器


一個好的vim編譯器配置, 能讓開發效率提升十倍, 這里推薦一個vim編輯器的配置文件 :?

vimrc 文件 下載地址 :?http://download.csdn.net/detail/han1202012/6684437?

使用xftp工具直接上傳到服務器的 root下.


vim編輯器在secureCRT上的效果 :?




有高亮顯示, 有代碼自動提示;


藍色注釋看得太費眼了, 改成綠色注釋, 在vimrc文件中加上 hi Comment ctermfg=green , 可以將注釋顏色改為綠色;




暫時就這樣配置了, 如果有進一步的改進, 在繼續在這篇博客上繼續改進.


3. 編譯運行C語言程序?


編譯剛才的文件 :?


執行成功, C語言開發環境安裝完畢!



三. 配置J2EE運行環境


1. 安裝tomcat


(1) 下載tomcat

tomcat下載地址 :?http://tomcat.apache.org/download-60.cgi

地址欄輸入下面地址可下載 :?http://mirror.esocc.com/apache/tomcat/tomcat-6/v6.0.37/bin/apache-tomcat-6.0.37-deployer.tar.gz?


使用xftp將tomcat上傳到阿里云服務器上, 將tomcat安裝到一個目錄中, 在目錄同級創建一個app目錄, 用來存放網站源碼, war包.




(2) 安裝配置tomcat


使用?tar xvfz apache-tomcat-6.0.37 命令 解壓tar.gz文件到當前文件;




解壓完成后 :?




為了方面起見, 更改tomcat目錄以及其子目錄下所有文件的訪問權限為755 : ?使用 chmod -R 755 目錄名/* 可以改變該目錄下所有子文件的訪問權限.?




修改tomcat/conf/server.xml配置 : ?在這個文件中添加Context配置, 這個配置指向網站源文件目錄 :?




在app目錄中存放網站的源文件 :?




(3) 啟動tomcat


啟動腳本位置在tomcat根目錄中的 bin 下的 startup.sh, 執行這個腳本文件 即可啟動tomcat .




查看啟動日志 :?




啟動 tomcat成功;


此時訪問 : http://115.28.42.124:8080 即可訪問該網站, 只是個demo.


2. 期間的一些排錯


好坎坷, 出了好多錯誤, 不過還好都解決了


tomcat啟動端口占用問題 : ?執行 ps -ef|grep java 可以查看java相關的進程




殺死被占用的進程 : kill -9 31658 就可以將該tomcat終止;


查看tomcat日志 命令 : tail -f -n 200 文件名?

其中的-f 是 日志滾動, -n 200 指定顯示多少航日志?


vim編輯器復制 : ctrl + shift + c?

vim編輯器粘貼 : ctrl + shift + v

.

作者?:萬境絕塵?

轉載請注明出處?:?http://blog.csdn.net/shulianghan/article/details/18964835

.


網站地址 :?http://115.28.42.124:8080 終于部署好了

360是流氓啊 啥都沒放就說我的網站有病毒?

總結

以上是生活随笔為你收集整理的【Linux 操作系统】阿里云服务器 操作实战 部署C语言开发环境(vim配置,gcc) 部署J2EE网站(jdk,tomcat)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。