.

作者 :万境绝尘 

转载请注明出处 : 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 Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                           Arch                                 Version                                     Repository                          Size
=============================================================================================================================================================
Installing:
 gcc                               x86_64                               4.1.2-54.el5                                base                               5.3 M

Transaction 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 Transaction
  Installing     : 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 and
                           multiple 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 headers
                           for 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 files
                           Permissible languages include: c c++ assembler none
                           'none' means revert to the default behavior of
                           guessing the language based on the file's extension

Options starting with -g, -f, -m, -O, -W, or --param are automatically
 passed on to the various sub-processes invoked by gcc.  In order to pass
 other 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)的更多相关文章

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

    . 作者 :万境绝尘  转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/18964835 . 博客总结 : 设置SecureCRT ...

  2. 【Linux】阿里云服务器部署--禅道

    Xshell部署环境 回到Xshell界面,连上阿里云服务器,参考上一篇[linux学习1-Xshell连接阿里云ECS服务器](https://www.cnblogs.com/yoyoketang/ ...

  3. 阿里云服务器连接以及centos 搭建 web java环境(linux java部署 tomcat部署)

    版权声明:本文为博主原创文章,未经博主允许不得转载. 最近弄了个试用阿里云服务器倒腾了半天终于部署好,分享一下. 1.登入阿里云打开你申请的是云服务器的实例: 点击重置密码---重置密码后重启服务器才 ...

  4. linux 【阿里云服务器】 配置 redis 的正确流程

    1.前言 我的域名备案前几天通过了,这篇随笔完整的记录 redis 的安装流程 与各种 问题 的 具体解决方案. 2.操作[跟着步骤来] (1)指令cd /usr/local 进入local文件夹里面 ...

  5. 快速学习C语言三: 开发环境, VIM配置, TCP基础,Linux开发基础,Socket开发基础

    上次学了一些C开发相关的工具,这次再配置一下VIM,让开发过程更爽一些. 另外再学一些linux下网络开发的基础,好多人学C也是为了做网络开发. 开发环境 首先得有个Linux环境,有时候家里机器是W ...

  6. 阿里云服务器发送邮件:Connection could not be established with host smtp.qq.com [Connection timed out #110]

    阿里云服务器发送邮件:Connection could not be established with host smtp.qq.com [Connection timed out #110] 一.总 ...

  7. Linux学习2-在阿里云服务器上部署禅道环境

    前言 以前出去面试总会被问到:测试环境怎么搭建?刚工作1-2年不会搭建测试环境还可以原谅自己,工作3-5年后如果还是对测试环境搭建一无所知,面试官会一脸的鄙视. 本篇以最简单的禅道环境搭建为例,学习下 ...

  8. laravel项目使用appnode部署linux系统到阿里云服务器流程记录(待补充)

    使用 SSH 连接工具,如 PuTTY.XShell.SecureCRT 等,连接 Linux 服务器后(阿里云服务器命令行内直接输入appnode安装命令,版本:mysql选5.7.php选7.2) ...

  9. 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署

    阿里云服务器Linux CentOS安装配置(九)shell编译.打包.部署 1.查询当前目录以及子目录下所有的java文件,并显示查询结果 find . -name *.java -type f - ...

随机推荐

  1. 开源框架Volley的使用《二》[NetWorkImageView&&LruCache&ImageLoader]

    转载本专栏每一篇博客请注明转载出处地址,尊重原创.此博客转载链接地址:小杨的博客    http://blog.csdn.net/qq_32059827/article/details/5278849 ...

  2. javascript之事件处理

    一般事件 onclick                       鼠标点击时触发此事件 ondblclick                  鼠标双击时触发此事件 onmousedown    ...

  3. 如何使用excel画甘特图

    甘特图小伙伴们都非常的熟悉,首先小编简单的向各位小伙伴介绍一下什么是甘特图,甘特图内在思想简单,即以图示的方式通过活动列表和时间刻度形象地表示出任何特定项目的活动顺序与持续时间.基本是一条线条图,横轴 ...

  4. 最简单的基于FFmpeg的libswscale的示例附件:测试图片生成工具

    ===================================================== 最简单的基于FFmpeg的libswscale的示例系列文章列表: 最简单的基于FFmpeg ...

  5. Spark技术内幕:一个图搞定Spark到底有多少行代码

    Spark1.0.0发布一个多月了,那么它有多少行代码(Line of Code, LOC)? 注:代码统计未包含测试,sample.

  6. Android开发学习之路--MediaPlayer之简单音乐播放器初体验

    很多时候我们都会用手机来播放音乐,播放视频,那么具体地要怎么实现呢,其实主要是MediaPlayer类来完成的.下面通过简单的例子来实现一首歌曲的播放吧.新建工程MediaPlayerStudy,这里 ...

  7. Android的数字选择器NumberPicker-android学习之旅(三十七)

    我想说的话 今天晚上我依然在图书馆写博客,其实此刻我的没心激动而忐忑,因为明天就是足球赛的决赛,我作为主力球员压力很大,因对对方很强大,但是那又怎么样.so what...我不会停止写博客的 Numb ...

  8. JSP自定义标签必知必会

    自定义标签技术自sun公司发布以来,便一向很受欢迎!下面我就来谈一谈如何实现自定义标签,以及如何使用自定义标签. 如何实现自定义标签 首先我们应该知道原理,不管是标签还是JSP,本身实际上都会被JSP ...

  9. 95%的bug是由程序员造成的

    原文作者:Jeff Atwood 作者在Twitter上发的一条短讯: "在怨天尤人之前,我们应该先自我反省.努力把自身的问题解决了." 12:22 PM –2012-5-30 你 ...

  10. UNIX环境高级编程——system V消息队列

    unix早期通信机制中的信号能够传送的信息量有限,管道则只能传送无格式字节流,这远远是不够的.     消息队列(也叫报文队列)客服了这些缺点:     消息队列就是一个消息的链表.     可以把消 ...