Linux服务器的配置

登录之后显示如下:

1 [root@VM_29_87_centos ~]# 

为root用户,版本为centos ~是当前目录/root。

然我们现在来分区:

当前没有分区和格式化,无法用 df -h 命令看到数据盘

1 [root@VM_29_87_centos ~]# df -h
2 Filesystem      Size  Used Avail Use% Mounted on
3 /dev/vda1        20G  1.1G   18G   6% /

然后输入fdisk -l 查看数据盘的信息:

1 [root@VM_29_87_centos ~]# fdisk -l
2
3 Disk /dev/vda: 21.5 GB, 21474836480 bytes
4 255 heads, 63 sectors/track, 2610 cylinders
5 Units = cylinders of 16065 * 512 = 8225280 bytes
6 Sector size (logical/physical): 512 bytes / 512 bytes
7 I/O size (minimum/optimal): 512 bytes / 512 bytes
8 Disk identifier: 0x0007ee22
9 
10 Device Boot      Start         End      Blocks   Id  System
11 /dev/vda1   *           1        2611    20970496   83  Linux

上面显示有一个21.5G的数据盘需要挂载分区

执行分区的操作如下:

1 fdisk /dev/vda
1 [root@VM_29_87_centos ~]# fdisk /dev/vdb
2
3 Unable to open /dev/vdb
4 [root@VM_29_87_centos ~]# fdisk /dev/vda
5
6 WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
7         switch off the mode (command 'c') and change display units to
8         sectors (command 'u').
9
10 Command (m for help): m
11 Command action
12 a   toggle a bootable flag
13 b   edit bsd disklabel
14 c   toggle the dos compatibility flag
15 d   delete a partition
16 l   list known partition types
17 m   print this menu
18 n   add a new partition
19 o   create a new empty DOS partition table
20 p   print the partition table
21 q   quit without saving changes
22 s   create a new empty Sun disklabel
23 t   change a partition's system id
24 u   change display/entry units
25 v   verify the partition table
26 w   write table to disk and exit
27 x   extra functionality (experts only)

根据帮助命令可知,先输入n新建分区,再输入p新建扩展分区。之后按wq保存退出。 
在输入fdisk -l 就可以看到新分区已经创建完成

1 [root@VM_29_87_centos ~]# fdisk -l
2
3 Disk /dev/vda: 21.5 GB, 21474836480 bytes
4 255 heads, 63 sectors/track, 2610 cylinders
5 Units = cylinders of 16065 * 512 = 8225280 bytes
6 Sector size (logical/physical): 512 bytes / 512 bytes
7 I/O size (minimum/optimal): 512 bytes / 512 bytes
8 Disk identifier: 0x0007ee22
9 
10   Device Boot      Start         End      Blocks   Id  System
11 /dev/vda1   *           1        2611    20970496   83  Linux

之后需要对分区进行格式化,文件系统可自行绝对(ext3,ext2)建议使用ext3 
使用如下的命令进行格式化分区。

1 root@VM_29_87_centos ~]# mkfs.ext3 /dev/vda1
2 mke2fs 1.41.12 (17-May-2010)
3 /dev/vda1 is mounted; will not make a filesystem here!

显示 已挂载 无法分区 
所以要先卸载分区再重新格式化

1 [root@VM_29_87_centos ~]# umount /dev/vda1
2 umount: /: device is busy.
3        (In some cases useful info about processes that use
4         the device is found by lsof(8) or fuser(1))

显示有程序使用/挂在该目录上,我们刚分的区,哪里来的程序?如何释放该程序呢? 
使用fuser - identify processes using files or sockets

1 [root@VM_29_87_centos ~]# fuser -m /dev/vda1
2 /dev/vda1:               1rce     2rc     3rc     4rc     5rc     6rc     7rc     8rc     9rc    10rc    11rc    12rc    13rc    14rc    15rc    16rc    17rc    18rc    19rc    20rc    21rc    22rc    23rc    24rc    25rc    26rc    27rc    28rc    29rc    30rc    32rc    33rc    34rc    35rc    36rc    37rc    44rc    46rc    47rc    48rc    80rc    81rc   184rc   186rc   210rc   335rc   423rce   464rc   594rc   615rc   746rc   749re   950rce   972rce   994rce  1032rce  1075rce  1167rce  1183rce  1187rce  1204rce  1244rce  1246rce  1248rce  1250rce  1252rce  1253rce  1254rce  1256rce  3125rce  3129rce  3189rce

重复之前的动作,分个vda2出来

1 [root@VM_29_87_centos ~]# fdisk /dev/vda
2
3 WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
4         switch off the mode (command 'c') and change display units to
5         sectors (command 'u').
6
7 Command (m for help): n
8 Command action
9   e   extended
10  p   primary partition (1-4)
11 e
12 Partition number (1-4): 1
13 Partition 1 is already defined.  Delete it before re-adding it.
14
15 Command (m for help): n
16 Command action
17 e   extended
18 p   primary partition (1-4)
19 p
20 Partition number (1-4): 2
21 No free sectors available

配tomcat环境

先安装nginx

一句代码

1 yum install nginx

再启动nginx服务。

1 [root@VM_29_87_centos ~]# service nginx start

检验nginx服务

1 [root@VM_29_87_centos ~]# service nginx start
2 Starting nginx:                                            [  OK  ]
3 [root@VM_29_87_centos ~]# sudo wget http://127.0.0.1
4 --2016-07-25 12:05:32--  http://127.0.0.1/
5 Connecting to 127.0.0.1:80... connected.
6 HTTP request sent, awaiting response... 200 OK
7 Length: 3698 (3.6K) [text/html]
8 Saving to: `index.html'
9 
10 100%[==============================================>] 3,698       --.-K/s   in 0s      
11
12 2016-07-25 12:05:32 (315 MB/s) - `index.html' saved [3698/3698]

毕竟是搞android的nginx用到的不多,所以php环境还是配置了。。。
安装: yum install php php-fpm 
启动:service php-fpm start 一句strat php的service 
现在写如何配jdk和tomcat
输入 java -version 
看是否有自带的openjdk版本

1 [root@VM_29_87_centos ~]# java -version
2 java version "1.7.0_95"
3 OpenJDK Runtime Environment (rhel-2.6.4.0.el6_7-x86_64 u95-b00)
4 OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

有的话就不用管,有人说要换成oracle的jdk 我看了下其实这两个差别不大,只是一个支持java8 一个不支持罢了 作为服务器我们java用的很少 主要是用tomcat 我们现在来看如何配tomcat 
http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html 下载你要的tomcat的版本 
然后用Filezila上传到linux服务器: 
再讲tomcat移动到 /usr/local/

1 
2 [root@VM_29_87_centos tomcat]# mv apache-tomcat-6.0.30/ /usr/local/

再在tomcat目录下执行如下操作:打开tomcat

1 [root@VM_29_87_centos tomcat]#  /usr/local/tomcat/bin/catalina.sh start

即可在外部的浏览器中输入ip地址和端口号看到tomcat猫了:

1 http://115.159.107.159:8080/

把index.html移动到webapps里面之后。还是无法访问。而且在分区的时候,不小心动了分区表然后出现grup错误。一直未能修复 
参考 http://www.2cto.com/os/201110/109140.html 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux服务器配置可以包括以下方面: 1. 硬件配置:选择适合服务器用途的硬件,如处理器、内存、硬盘等。确保服务器的硬件满足计算和存储需求。 2. 操作系统选择:选择适合你需求的Linux发行版,如Ubuntu、CentOS等。根据服务器的用途和技术要求,选择合适的操作系统版本。 3. 安全配置:确保服务器安全是非常重要的。你可以采取一些措施来提高服务器的安全性,如禁用不必要的服务、配置防火墙、启用SSH密钥认证、定期更新系统补丁等。 4. 网络配置:为服务器配置网络设置,确保服务器能够正常通信。这包括为服务器分配静态IP地址、配置DNS设置、设置网络接口等。 5. 软件安装和配置:根据需求安装所需的软件包,并进行相应的配置。例如,安装web服务器(如Nginx或Apache)、数据库服务器(如MySQL或PostgreSQL)等。 6. 监控和日志管理:设置监控工具和日志管理,以便实时监控服务器的系统性能和运行状况,并对日志进行适当管理。 7. 备份策略:制定备份策略,确保服务器数据的安全性和可恢复性。定期备份重要数据,并测试还原过程。 8. 远程访问和管理:设置远程访问和管理机制,以便能够远程登录和管理服务器。这可以通过SSH、远程桌面等方式来实现。 9. 性能优化:对服务器进行性能优化,以提高其效率和响应速度。这可能涉及调整内核参数、优化数据库配置、使用缓存等技术手段。 10. 定期维护和更新:定期进行服务器维护和更新,包括安全补丁、软件升级等。确保服务器始终处于最新的稳定状态。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值