Android开发服务器的搭建

Android开发服务器的搭建


第一部分,选取交叉编译的硬件平台

Android的SDK包很大,源码至少3.5G以上,因此交叉编译的代码量也是相当大。 笔者,曾用DELL Latitude E5410(i3机型)Ubuntu实体机(非虚拟机)首次编译,整整花了10个小时编译。所以各位,“工欲善其事必先利其器”,推荐使用以下配置:
  • CPU:Intel i7-4770。
  • RAM:金士顿 16G DDR3-1600。
  • HD:西部数据 500G。
*主机详细配置请参阅附录1


第二部分,服务器的搭建

一,安装Linux系统
在安装前请准备一张已经可好的ubuntu-12.04LTS-AMD64.iso的光盘。 在光驱内插入光盘,重新启动机器,按照ubuntu安装提示一步一步即可。
在这里有几点建议:
第一点,最好预留一个SWAP分区16G。
第二点,作为Linux开发服务器,整个硬盘最好只安装ubuntu系统。
第三点,划分一个分区挂载到/home;而且这个分区要求一定要足够大。

二,安装SSH服务

在ubuntu服务器端,安装SSH服务。步骤如下:

1,安装软件包,执行

$ sudo apt-get install openssh-server

ubuntu CD版本缺省安装openssh-client;如果你的系统没有安装的话,那么请执行下面命令即可。

$ sudo apt-get install openssh-client

2,然后确认sshserver是否启动,执行

$ ps -e |grep ssh  

如果只有ssh-agent,那么说明ssh-server还没有启动;如果看到sshd那说明ssh-server已经启动了。


3,ssh-server配置文件位于/etc/ssh/sshd_config中,使用以下命令参看。

$ cat /etc/ssh/sshd_config

SSH默认端口是22,可以定义SSH的服务端口,也可以改成其他端口。


4,然后重启SSH服务

$ sudo /etc/init.d/ssh restart

5,Windows机上,选用熟悉的远程登录工具,设置Ubuntu的IP地址、开放的用户名和密码、协议是SSH2、默认端口22,即可。



三,下载远程登录工具。
在Windows机端,推荐使用Putty或Xshell。

四,使用SSH服务登录Linux服务器(Windows端)
1,Linux服务器端,可以使用ifconfig命令手动设置服务器的IP,例如:192.168.1.101。
2,在远程登录软件中填入IP信息,输入用户名和密码。
3,登录成功。

五,安装SAMBA服务

1,安装samba服务套件

$ sudo apt-get install samba

安装系统设置的共享模块

$ sudo apt-get install kdenetwork-filesharing

2,配置samba服务

第一步,创建共享目录

创建:/home/jack/share。/home/jack/是笔者的服务器的普通用户的用户目录,读者将jack改为您使用的目录即可。

创建share目录:

$ mkdir /home/jack/share


第二步,设置目录的权限
设置该文件夹的权限,使新目录让所有用户可读可写可执行。如果读者觉得给目录全部的权限不妥当,请自行改为您认为安全妥当的权限。
$ chmod -R 0777 /home/jack/share

第三步,备份smb.conf
在Linux上修改脚本前,要养成随时备份的习惯。
备份smb.conf文件:

$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup


第四步,修改smb.conf脚本

  • 使用vim修改脚本:

$ sudo gedit /etc/samba/smb.conf

  • 在smb.conf中搜寻这一行文字代码:
; security = user

用下面这几行取代

 security = user
 username map = /etc/samba/smbusers


  • 在smb.conf中增加新用户new的共享目录

将下列几行新增到文件的最后面,新创建允许访问的用户为:new,共享目录为 /home/jack/share。

[Share]
comment = Shared Folder with username and password
path = /home/jack/share
public = yes
writable = yes
valid users = new
create mask = 0700
directory mask = 0700
force user = nobody
force group = nogroup
available = yes
browseable = yes

  • 增加新用户的一些其他属性

找到[global],

将旧属性

workgroup = MSHOME 

改成 (这里的WORKGROUP是共享中的工作组名称):

workgroup = WORKGROUP
display charset = UTF-8
unix charset = UTF-8
dos charset = cp936

后三行,为了防止出现中文目录乱码的情况。


  • 添加新网络访问帐户

添加新的网络访问账户:new

$ sudo useradd new

上面只是增加了new这个用户,却没有给用户赋予本机登录密码。所以这个用户将只能从远程访问,不能从本机登录。而且samba的登录密码可以和本机登录密码不一样。


  • 新增网络使用者的帐号

$ sudo smbpasswd -a new
设置new密码。这个密码不是开机登录时候用的,而是访问Windows共享文件时要填的密码。

  • 新建/etc/samba/smbusers文件

$ sudo vim /etc/samba/smbusers

在新建的文件内加入下面行并保存

new = “network username”


  • new用户的管理

修改new用户的网络访问密码,使用下行命令:

$ sudo smbpasswd -a new
删除new这个访问账户,使用下行命令:

$ sudo smbpasswd -x new

  • 测试samba服务

测试samba服务:
$ sudo testparm

当你输入上面的命令的时候有可能会出现“执行子进程“testparm”失败没有该文件或目录”, 这是你要重新输入命令:

$ sudo apt-get install samba-common-bin

这个问题就解决了。


  • 重新启动samba服务

输入重启命令:

$ sudo /etc/init.d/smbd restart

到这,samba服务就配置完成。点开你的win下网上邻居 查看工作组计算机里面就有共享的samba服务,不过前提是你已经开启samba服务

  • Windows端打开共享目录

samba服务开启了,网上邻居下查看工作组计算机里面就有共享的samba服务。进入共享目录,输入用户名:new和密码:xxxxxx。


第五步,整个安装过程终了。



第三部分,附录
  1. 附录1:主机的详细配置
jack-i7
    description: Desktop Computer
    product: All Series (All)
    vendor: ASUS
    version: System Version
    serial: System Serial Number
    width: 64 bits
    capabilities: vsyscall32
    configuration: administrator_password=disabled boot=normal chassis=desktop family=ASUS MB frontpanel_password=disabled keyboard_password=disabled power-on_password=disabled sku=All uuid=E09BCD47-DAD7-DD11-AC19-AC220B83572C
  *-core
       description: Motherboard
       product: B85-PLUS
       vendor: ASUSTeK COMPUTER INC.
       physical id: 0
       version: Rev X.0x
       serial: 130713881100238
       slot: To be filled by O.E.M.
     *-firmware
          description: BIOS
          vendor: American Megatrends Inc.
          physical id: 0
          version: 0602
          date: 07/16/2013
          size: 64KiB
          capacity: 15MiB
          capabilities: pci apm upgrade shadowing cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb biosbootspecification
     *-memory:0 UNCLAIMED
          physical id: 1
        *-bank UNCLAIMED
             description: DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
             product: KHX1600C10D3/8GX
             vendor: Kingston
             physical id: 0
             serial: 18170682
             slot: ChannelA-DIMM0
             size: 8GiB
             width: 64 bits
             clock: 1600MHz (0.6ns)
     *-memory:1
          description: System Memory
          physical id: 42
          slot: System board or motherboard
        *-bank:0
             description: DIMM [empty]
             product: [Empty]
             vendor: [Empty]
             physical id: 0
             serial: [Empty]
             slot: ChannelA-DIMM1
        *-bank:1
             description: DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
             product: KHX1600C10D3/8GX
             vendor: Kingston
             physical id: 1
             serial: 18170682
             slot: ChannelB-DIMM0
             size: 8GiB
             width: 64 bits
             clock: 1600MHz (0.6ns)
        *-bank:2
             description: DIMM [empty]
             product: [Empty]
             vendor: [Empty]
             physical id: 2
             serial: [Empty]
             slot: ChannelB-DIMM1
     *-cache:0
          description: L1 cache
          physical id: 49
          slot: CPU Internal L1
          size: 256KiB
          capacity: 256KiB
          capabilities: internal write-back
     *-cache:1
          description: L2 cache
          physical id: 4a
          slot: CPU Internal L2
          size: 1MiB
          capacity: 1MiB
          capabilities: internal write-back unified
     *-cache:2
          description: L3 cache
          physical id: 4b
          slot: CPU Internal L3
          size: 8MiB
          capacity: 8MiB
          capabilities: internal write-back unified
     *-cpu
          description: CPU
          product: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
          vendor: Intel Corp.
          physical id: 4f
          bus info: cpu@0
          version: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
          slot: SOCKET 1150
          size: 800MHz
          capacity: 3900MHz
          width: 64 bits
          clock: 100MHz
          capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cpufreq
          configuration: cores=4 enabledcores=4 threads=8
     *-memory:2 UNCLAIMED
          physical id: 2
     *-memory:3 UNCLAIMED
          physical id: 3
     *-pci
          description: Host bridge
          product: 4th Gen Core Processor DRAM Controller
          vendor: Intel Corporation
          physical id: 100
          bus info: pci@0000:00:00.0
          version: 06
          width: 32 bits
          clock: 33MHz
        *-pci:0
             description: PCI bridge
             product: Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller
             vendor: Intel Corporation
             physical id: 1
             bus info: pci@0000:00:01.0
             version: 06
             width: 32 bits
             clock: 33MHz
             capabilities: pci pm msi pciexpress normal_decode bus_master cap_list
             configuration: driver=pcieport
             resources: irq:40
        *-display
             description: VGA compatible controller
             product: Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller
             vendor: Intel Corporation
             physical id: 2
             bus info: pci@0000:00:02.0
             version: 06
             width: 64 bits
             clock: 33MHz
             capabilities: msi pm vga_controller bus_master cap_list rom
             configuration: driver=i915 latency=0
             resources: irq:45 memory:f7800000-f7bfffff memory:e0000000-efffffff ioport:f000(size=64)
        *-usb:0
             description: USB controller
             product: 8 Series/C220 Series Chipset Family USB xHCI
             vendor: Intel Corporation
             physical id: 14
             bus info: pci@0000:00:14.0
             version: 05
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi xhci bus_master cap_list
             configuration: driver=xhci_hcd latency=0
             resources: irq:41 memory:f7d00000-f7d0ffff
        *-communication
             description: Communication controller
             product: 8 Series/C220 Series Chipset Family MEI Controller #1
             vendor: Intel Corporation
             physical id: 16
             bus info: pci@0000:00:16.0
             version: 04
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi bus_master cap_list
             configuration: driver=mei latency=0
             resources: irq:44 memory:f7d1b000-f7d1b00f
        *-usb:1
             description: USB controller
             product: 8 Series/C220 Series Chipset Family USB EHCI #2
             vendor: Intel Corporation
             physical id: 1a
             bus info: pci@0000:00:1a.0
             version: 05
             width: 32 bits
             clock: 33MHz
             capabilities: pm debug ehci bus_master cap_list
             configuration: driver=ehci-pci latency=0
             resources: irq:20 memory:f7d18000-f7d183ff
        *-multimedia
             description: Audio device
             product: 8 Series/C220 Series Chipset High Definition Audio Controller
             vendor: Intel Corporation
             physical id: 1b
             bus info: pci@0000:00:1b.0
             version: 05
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi pciexpress bus_master cap_list
             configuration: driver=snd_hda_intel latency=0
             resources: irq:46 memory:f7d10000-f7d13fff
        *-pci:1
             description: PCI bridge
             product: 8 Series/C220 Series Chipset Family PCI Express Root Port #1
             vendor: Intel Corporation
             physical id: 1c
             bus info: pci@0000:00:1c.0
             version: d5
             width: 32 bits
             clock: 33MHz
             capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
             configuration: driver=pcieport
             resources: irq:16 ioport:2000(size=4096) memory:de200000-de3fffff ioport:de400000(size=2097152)
        *-pci:2
             description: PCI bridge
             product: 8 Series/C220 Series Chipset Family PCI Express Root Port #3
             vendor: Intel Corporation
             physical id: 1c.2
             bus info: pci@0000:00:1c.2
             version: d5
             width: 32 bits
             clock: 33MHz
             capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
             configuration: driver=pcieport
             resources: irq:18 ioport:e000(size=4096) memory:f7c00000-f7cfffff ioport:f0000000(size=1048576)
           *-network
                description: Ethernet interface
                product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
                vendor: Realtek Semiconductor Co., Ltd.
                physical id: 0
                bus info: pci@0000:03:00.0
                logical name: eth0
                version: 0c
                serial: ac:22:0b:83:57:2c
                size: 100Mbit/s
                capacity: 1Gbit/s
                width: 64 bits
                clock: 33MHz
                capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
                configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168g-1_0.0.3 10/23/12 ip=192.168.1.100 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
                resources: irq:43 ioport:e000(size=256) memory:f7c00000-f7c00fff memory:f0000000-f0003fff
        *-pci:3
             description: PCI bridge
             product: 82801 PCI Bridge
             vendor: Intel Corporation
             physical id: 1c.3
             bus info: pci@0000:00:1c.3
             version: d5
             width: 32 bits
             clock: 33MHz
             capabilities: pci pciexpress msi pm subtractive_decode bus_master cap_list
           *-pci
                description: PCI bridge
                product: ASM1083/1085 PCIe to PCI Bridge
                vendor: ASMedia Technology Inc.
                physical id: 0
                bus info: pci@0000:04:00.0
                version: 03
                width: 64 bits
                clock: 33MHz
                capabilities: pci subtractive_decode bus_master cap_list
                resources: iomemory:202001f10-202001f0f
        *-usb:2
             description: USB controller
             product: 8 Series/C220 Series Chipset Family USB EHCI #1
             vendor: Intel Corporation
             physical id: 1d
             bus info: pci@0000:00:1d.0
             version: 05
             width: 32 bits
             clock: 33MHz
             capabilities: pm debug ehci bus_master cap_list
             configuration: driver=ehci-pci latency=0
             resources: irq:23 memory:f7d17000-f7d173ff
        *-isa
             description: ISA bridge
             product: B85 Express LPC Controller
             vendor: Intel Corporation
             physical id: 1f
             bus info: pci@0000:00:1f.0
             version: 05
             width: 32 bits
             clock: 33MHz
             capabilities: isa bus_master cap_list
             configuration: driver=lpc_ich latency=0
             resources: irq:0
        *-storage
             description: SATA controller
             product: 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode]
             vendor: Intel Corporation
             physical id: 1f.2
             bus info: pci@0000:00:1f.2
             version: 05
             width: 32 bits
             clock: 66MHz
             capabilities: storage msi pm ahci_1.0 bus_master cap_list
             configuration: driver=ahci latency=0
             resources: irq:42 ioport:f0b0(size=8) ioport:f0a0(size=4) ioport:f090(size=8) ioport:f080(size=4) ioport:f060(size=32) memory:f7d16000-f7d167ff
        *-serial UNCLAIMED
             description: SMBus
             product: 8 Series/C220 Series Chipset Family SMBus Controller
             vendor: Intel Corporation
             physical id: 1f.3
             bus info: pci@0000:00:1f.3
             version: 05
             width: 64 bits
             clock: 33MHz
             configuration: latency=0
             resources: memory:f7d15000-f7d150ff ioport:f040(size=32)
     *-scsi:0
          physical id: 4
          logical name: scsi2
          capabilities: emulated
        *-disk
             description: ATA Disk
             product: ST500DM002-1BD14
             vendor: Seagate
             physical id: 0.0.0
             bus info: scsi@2:0.0.0
             logical name: /dev/sda
             version: KC48
             serial: W2AWZB7N
             size: 465GiB (500GB)
             capabilities: partitioned partitioned:dos
             configuration: ansiversion=5 signature=0005c4fe
           *-volume:0
                description: EXT4 volume
                vendor: Linux
                physical id: 1
                bus info: scsi@2:0.0.0,1
                logical name: /dev/sda1
                logical name: /
                version: 1.0
                serial: 04260d4f-b5e5-4347-af32-75ea9b2937a5
                size: 450GiB
                capacity: 450GiB
                capabilities: primary bootable journaled extended_attributes large_files huge_files dir_nlink recover extents ext4 ext2 initialized
                configuration: created=2013-09-20 17:52:06 filesystem=ext4 lastmountpoint=/ modified=2013-10-05 22:31:21 mount.fstype=ext4 mount.options=rw,relatime,errors=remount-ro,data=ordered mounted=2013-12-02 10:30:45 state=mounted
           *-volume:1
                description: Extended partition
                physical id: 2
                bus info: scsi@2:0.0.0,2
                logical name: /dev/sda2
                size: 15GiB
                capacity: 15GiB
                capabilities: primary extended partitioned partitioned:extended
              *-logicalvolume
                   description: Linux swap / Solaris partition
                   physical id: 5
                   logical name: /dev/sda5
                   capacity: 15GiB
                   capabilities: nofs
     *-scsi:1
          physical id: 5
          logical name: scsi3
          capabilities: emulated
        *-cdrom
             description: DVD reader
             product: DVD-E818A9T   b
             vendor: ASUS
             physical id: 0.0.0
             bus info: scsi@3:0.0.0
             logical name: /dev/cdrom
             logical name: /dev/dvd
             logical name: /dev/sr0
             version: 1.00
             capabilities: removable audio dvd
             configuration: ansiversion=5 status=nodisc
  *-power UNCLAIMED
       description: To Be Filled By O.E.M.
       product: To Be Filled By O.E.M.
       vendor: To Be Filled By O.E.M.
       physical id: 1
       version: To Be Filled By O.E.M.
       serial: To Be Filled By O.E.M.
       capacity: 32768mWh










你可能感兴趣的:(Linux驱动,android,驱动开发)