openwrt学习配置从零开始(centos7虚拟机)-----最好准备30G空间较为妥当

centos7 网络设置

先得到相应配置
点击虚拟器—编辑—虚拟网络编辑器
查看VMnet8
并设置为NAT模式

在这里插入图片描述
点击“NAT设置”得到:
GATEWAY0=192.168.111.2
NETMASK=255.255.255.0
在这里插入图片描述
点击:“DHCP设置”得到:
根据范围随便取后三位
IPADDR0=192.168.111.140最后三位取图框范围
在这里插入图片描述
DNS1=114.114.114.114(域名系统IP地址)
114.114.114.114和8.8.8.8是常见的DNS地址,8.8.8.8为GOOGLE公司DNS地址是全球通用的,而114.114.114.114是全国通用DNS地址

开始步入正题:
root@~# vim /etc/sysconfig/network-scripts/ifcfg-eno16777728
(不同的系统网卡配置不一定是eno16777728)

    TYPE=Ethernet
    BOOTPROTO=static
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    NAME=eno16777728
    UUID=69c3a975-7609-4fc4-b681-f1371e9bcc1d
    ONBOOT=yes
    
    IPADDR0=192.168.111.140
    PREFIX0=32
    GATEWAY0=192.168.111.2
    DNS1=114.114.114.114
    NETMASK=255.255.255.0
    HWADDR=00:0C:29:D1:2B:0B
    IPV6_PEERDNS=yes
    IPV6_PEERROUTES=yes

修改部分:

BOOTPROTO=static (为静态地址模式)
ONBOOT=yes

IPADDR0=192.168.111.140
GATEWAY0=192.168.111.2
NETMASK=255.255.255.0
DNS1=114.114.114.114
保存退出(:wq)

root@~# systemctl restart network(重启网络服务)
root@~# ifconfig (查看网络设置)
如图
在这里插入图片描述
配置完成!
点开firfeox看是否能上网
或者
“ping 相应网络IP地址”(ctrl+c结束ping)
最后记住虚拟机-网络适配-设置为NAT模式:
在这里插入图片描述

##为openwrt环境准备

先挂载镜像文件//该虚拟机点击‘’设置‘’–选择‘’CD/DVD‘’点击使用ISO镜像文件(设置后默认在 dev/cdrom)
在这里插入图片描述

 mkdir -p /media/cdrom
 mount /dev/cdrom /media/cdrom
 vim /etc/fstab
  #添加如下
  /dev/cdrom	/media/cdrom	iso9660 defaults 0 0
  保存退出

重装yum与python>3.5(我是干脆直接删除原有没有跟新的,直接Firefox上下载相应的包)

1. 卸载现有的python

强制删除已安装程序及其关联

rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps

强制删除所有残余文件

whereis python |xargs rm -frv

2.卸载现有的yum

rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps

强制删除所有残余文件

whereis yum |xargs rm -frv

看下自己系统版本

cat /etc/redhat-release

下载所有需要的包

libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm
python-2.7.5-68.el7.x86_64.rpm
python-backports-1.0-8.el7.x86_64.rpm
python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
python-chardet-2.2.1-1.el7_1.noarch.rpm
python-devel-2.7.5-68.el7.x86_64.rpm
python-iniparse-0.4-9.el7.noarch.rpm
python-ipaddress-1.0.16-2.el7.noarch.rpm
python-kitchen-1.1.1-5.el7.noarch.rpm
python-libs-2.7.5-68.el7.x86_64.rpm
python-pycurl-7.19.0-19.el7.x86_64.rpm
python-setuptools-0.9.8-7.el7.noarch.rpm
python-urlgrabber-3.10-8.el7.noarch.rpm
python-virtualenv-15.1.0-2.el7.noarch.rpm
rpm-4.11.3-32.el7.x86_64.rpm
rpm-build-4.11.3-32.el7.x86_64.rpm
rpm-build-libs-4.11.3-32.el7.x86_64.rpm
rpm-libs-4.11.3-32.el7.x86_64.rpm
rpm-python-4.11.3-32.el7.x86_64.rpm
rpm-sign-4.11.3-32.el7.x86_64.rpm
yum-3.4.3-158.el7.centos.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-aliases-1.1.31-45.el7.noarch.rpm
yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
yum-plugin-protectbase-1.1.31-45.el7.noarch.rpm
yum-utils-1.1.31-45.el7.noarch.rpm
考验你眼力的时候到了,,哈哈。。嘻嘻,,我当时看的眼睛都花了。。该你了。。

地址 :https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
接下来创文件

mkdir -p  /root/openwrt/download-file
cd /root/openwrt/download-file

下载好相应包将包移至创建的文件

mv  *  /root/openwrt/download-file`

rpm -Uvh --replacepkgs *.rpm

在yum安装成功后,可将源文件清空并下载新的源
可参考:https://blog.csdn.net/qq_36731677/article/details/58288979
之后逐步更新源数据

yum clean all
yum makecache

原文:https://blog.csdn.net/qq_36731677/article/details/83552436

更新phyton

那么安装好了后现在要跟新python(要求大于>=3.5)
首先

vim /etc/yum.repos.d/CentOS-Base.repo
将所有的releasever改为7
:/%s/releasever/7    
这个时候还没有结束               
(但是地址的‘$’要把他删掉,这个只能手动了比如:baseurl=http://mirror.centos.org/centos/$7/os/$basearch/  
将其‘$’删掉改为: baseurl=http://mirror.centos.org/centos/7/os/$basearch/  具体的地址看你下载文件,,只需要改数字前面的$,地址的其他部位不要改动)

最终保存退出

  1. 安装python必要依赖项
    yum install openssl-devel -y
    yum install zlib-devel –y

  2. 下载相应的Pytho3.xxn版本,地址:https://www.python.org/ftp/python/3.7.0/
    (我用的是3.7(用Linux下Firefox)下载下面的 Python-3.7.0.tar.xz )
    解压文件

    tar -xf Python-3.7.0.tar.xz

    cd 到解压的python文件下

    执行:./configure --prefix=“path” (–prefix=“path”可以不用,就使用默认目录/usr/local/bin/就好)如果提示:noacceptable C compiler found in $PATH,说明没有提示没有GCC编译器环境,执行:yum -y install gcc,如果运行失败,说明你的yum源没有修改成功,重复执行上面步骤。

  3. 然后执行 make

  4. 在执行 make install

  5. 升级pip3到9.0.3: pip3 install --upgrade pip

  6. 10、安装Twisted(scrapy依赖Twisted)
    wget https://twistedmatrix.com/Releases/Twisted/17.1/Twisted-17.1.0.tar.bz2
    tar -jxvf Twisted-17.1.0.tar.bz2
    cd Twisted-17.1.0
    python3 setup.py install
    cd …

  7. 安装scrapy
    pip3 install scrapy

  8. 导入Python3所需三方库
    pip3 install –r requirments.txt

    之前报错
    ERROR: Invalid requirement: ‘–r’
    后面我用了
    pip3 freeze > requirements.txt
    pip install -r requirements.txt
    会有警告表明已经存在Requirement already satisfied: a…
    不用管已经导入

  9. 可以看一下版本
    python3 -V

参照的:https://blog.csdn.net/beyond_f4/article/details/79724850
文章

开始装openwrt

参照的是简书的一篇文章
https://www.jianshu.com/p/3a73f3e47978
首先

  1. 安装各种基础编译组建
    yum install asciidoc autoconf binutils bison build-essential bzip2 flex gawk gettext git libncurses5-dev libssl-dev libxml-parser-perl libz-dev patch quilt subversion uglifyjs unzip xsltproc zlib1g-dev

如果后面编译的时候提示缺少XX组件,请按照提示找,后面会给相应措施

  1. git各种源码(我还是用的root 但是 原文提醒不用root 那么上面创建的openwrt就不行 ,如果要用用户登录,那么在用户下创建一个mkdir -p ~/openwrt)

关键的来了,看你是否能上GitHub如果不能可以去网上找方法一般为修改hosts 但是网速还是很慢用着不踏实

我用的就是国内的 码云 导过来
原文: git源代码:git clone git://github.com/openwrt/openwrt.git

那么自己克隆个项目到码云上

  1. 首先登录github
    点开
    https://github.com/openwrt/openwrt
    frok项目在这里插入图片描述

  2. 登上码云官网https://gitee.com/(自己可以创建一个)
    在这里插入图片描述
    从GitHub到入仓库
    那么就有了‘自己’的openwrt

  3. 开始git 码云上的openwrt源码
    比如我的就是
    git clone https://github.com/lisirshenlin/openwrt.git
    现在就静静等待

  4. 移到下载的文件 参照 :https://www.cnblogs.com/sherlock-merlin/p/9494552.html
    cd 你下载好的openwrt下

    更新源 ,安装下载好的包

    ./scripts/feeds update -a
    ./scripts/feeds install -a (或者 'install ’ )

出现错误(典型的错误 不好找的):
Please install the Perl Thread::Queue module(这个比较难找)

yum install perl-Thread-Queue -y

或者去
https://centos.pkgs.org/7/centos-x86_64/perl-Thread-Queue-3.02-2.el7.noarch.rpm.html

配置openwrt出现错误:

you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log’ for more details

export FORCE_UNSAFE_CONFIGURE=1

配置好了就 make menuconfig

在这里插入图片描述
就如这样 由于路由器还没到所以就没有刷固件了
本人小白,有问题的地方请谅解。

最后

openwrt路由器刷固件;
https://blog.csdn.net/dxt1107/article/details/81609033

刚下好的openwrt没有luci选项。
https://www.cnblogs.com/rohens-hbg/p/7611908.html

建议路由器不一定用极路由,可以用其他相对好弄得,网上有教程,翻墙Google搜索方法好找一点。

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

菜c菜

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值