ubuntu-16.04 下Openwrt开发编译环境搭建

Linux 开发编译环境搭建

1.操作步骤
安装linux系统。
安装ssh
安装samba
安装编译相关的工具链,验证编译操作

2.安装linux.
从官网上下载iso安装包,可以直接安装可装成虚拟机,这一步操作网上说明较多,全部按提示来操作即可。
http://mirrors.aliyun.com/ubuntu-releases/16.04/

3.安装ssh
3.1 安装命令为:
sudo apt-get update
sudo apt-get install openssh-server

3.2 安装好后查看SSH是否启动
sudo ps -e |grep ssh
查看是否存在sshd

3.3 修改/etc/ssh/sshd_config
注释掉PermitRootLogin without-password
增加PermitRootLogin yes

3.4 vi操作出现异常处理
Vi操作时移动键不能用,可以重装vim.
sudo apt-get remove vim-common
sudo apt-get install vim
出错处理
sudo apt-get update && sudo apt-get install vim

3.5 在linux下使用ssh命令测试

$ ssh test@192.168.1.11
Connecting to 192.168.1.11:22...
Could not connect to '192.168.1.11' (port 22): Connection failed.

这个错误是由于ubuntu主机上的防火墙没有关闭,关闭防火墙即可。
sudo ufw disable #注意这个命令也是仅仅针对ubuntu系统

3.6 在windows下使用SecureCRT访问出错

这里写图片描述
就是将ssh_config文件中的
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
复制到sshd_config文件中,然后重启服sshd服务器。
sudo /etc/init.d/ssh restart

4.安装samba

sudo apt-get install samba

4.1 增加用户:
sudo useradd -s /bin/bash -g test -m test
sudo passwd test
sudo smbpasswd -a test

4.2 修改/etc/samba/smb.conf

smb.conf 里添加共享

[HomeShare]
        comment = Home Public Folder
        path = /home/test
        writable = yes
        valid users = test

修改完后,重启smb
sudo /etc/init.d/samba restart

4.3 mount samba目录(可选)
mount -t cifs //192.168.20.170/HomeShare /media/tmp/ -o username=test
需要安装:
apt-get install smbfs 或者cifs-utils

4.4 解决samba 无法访问软连接的问题:
在配置文件/etc/samba/smb.conf的“[global]”节的最后,加上下面三条设置:
follow symlinks = yes
wide links = yes
unix extensions = no

5.安装编译相关的工具链,验证编译操作
openwrt 安装下面的patch即可
sudo apt-get install git subversion
sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev subversion git-core gawk asciidoc libz-dev zlib1g-dev libssl-dev

下载OpenWrt源码:
通过git来下载OpenWrt bleeding edge
从官方源下载:git clone git://git.openwrt.org/openwrt.git
git clone git://git.openwrt.org/15.05/openwrt.git,下载时间比较漫长,请耐心等待。

添加软件扩展包:
cd openwrt/进入/home/kevinfan/openwrt/openwrt目录,可以找到feeds.conf.default文件,将feeds.conf.default修改为feeds.conf,使用以下命令:
cp feeds.conf.default feeds.conf
得到feeds.conf文件

更新扩展,安装扩展:
./scripts/feeds update -a
./scripts/feeds install -a

编译
make

猜你喜欢

转载自blog.csdn.net/huyb100/article/details/82225466