赞
踩
ubuntu18.04已经默认安装好了docker,可以直接使用。其他版本使用
wget -qO- https://get.docker.com/ | sh
命令来安装
启动docker服务
service docker start
安装好后在/etc/default/docker文件中末尾增加一行:
DOCKER_OPTS="–registry-mirror=http://hub-mirror.c.163.com"
然后重新运行docker服务:
service docker restart
docker pull ubuntu:14.04
docker images
docker run -t -i ubuntu:14.04 /bin/bash
结果如下
root@ea25e72ee089:/#
@后面跟的是该容器的id,保存的时候切记先在另一个终端使用docker commit [id] [name]保存后再关闭原来运行docker这个终端,docker不是虚拟机,不会自动保存容器内做的修改。
vi /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
修改完成后更新源
apt-get update
apt-get install build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libavcodec-dev libavformat-dev libswscale-dev libjpeg-dev libpng-dev wget libcanberra-gtk-module gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
wget https://github.com/opencv/opencv/archive/2.4.9.tar.gz
tar -zxvf 2.4.9.tar.gz
cd opencv-2.4.9**
去掉交叉编译器的版本
set(CMAKE_C_COMPILER arm-linux-gnueabi${FLOAT_ABI_SUFFIX}-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabi${FLOAT_ABI_SUFFIX}-g++)
./platforms/scripts/cmake_arm_gnueabi_hardfp.sh
因为编译脚本的bug造成找不到CMAKE_AR程序,所以手动修改下cmake脚本
cd build_linux_arm_hardfp
vi CMakeFiles/2.8.12.2/CMakeCCompiler.cmake
修改为:
set(CMAKE_AR "arm-linux-gnueabihf-ar")
make
make install
生成的opencv库文件在install目录下
docker cp ea25e72ee089:opencv2.4.9/platforms/build_linux_arm_hardfp/install /tmp
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。