一、配置基本环境
1、设置root密码
sudo passwd root
2、安装vim
sudo apt-get remove vim-common
sudo apt-get install vim
3、开启SSH
ps -e|grep ssh
sudo apt-get install openssh-server
sudo vi /etc/ssh/sshd_config
#PermitRootLogin without-password
#注释掉这行
PermitRootLogin yes
#增加这行
sudo service ssh start
ps -e|grep ssh
4、开放22端口
sudo apt-get install iptables
sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -I INPUT -p tcp --dport 8099 -j ACCEPT
sudo iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
sudo iptables-save
5、持久化
sudo apt-get install iptables-persistent
sudo netfilter-persistent save
sudo netfilter-persistent reload
reboot
二、配置java环境
1、下载linux java的jdk上传到/usr/local/java
tar -zxvf jdk-8u161-linux-x64.tar.gz
vim /etc/profile
#set Java environmen
export JAVA_HOME=/usr/local/java/jdk1.8.0_161
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=/usr/bin:${JAVA_HOME}/bin:$PATH
source /etc/profile
三、安装ant
1、解压tar -zxvf apache-ant-1.9.15-bin.tar.gz
2、修改配置文件vim /etc/profile
#set Java environmen
export JAVA_HOME=/usr/local/java/jdk1.8.0_161
export JRE_HOME=${JAVA_HOME}/jre
export ANT_HOME=/usr/local/java/apache-ant-1.9.15
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=/usr/bin:${JAVA_HOME}/bin:$ANT_HOME/bin:$PATH
3、刷新source /etc/profile 查看版本ant -version
四、安装opencv
1、下载opencv-4.4.0.tar.gz
网址 https://www.bzblog.online/wordpress/index.php/2020/03/09/opencvdownload/
2、至/usr/local/java并解压
tar -zxvf opencv-4.4.0.tar.gz
cd opencv-4.4.0/
3、新建一个build文件夹
mkdir build
cd build/
4、下载cmake
apt install cmake #先下载cmake
sudo apt-get install cmake
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev
5、在终端里输入
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
6、用cmake生成java的jar
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -DBUILD_TESTS=OFF ..
7、结束后输入如下口令
make -j8
sudo make install
8、结果
build/bin下有so文件、build/lib下有jar文件 表示操作成功