linux环境配置

毕设需要在linux开发环境上面进行,不同于之前的学习过程,这次是要进行工程开发。在使用的整个过程,自己也是有自己的一些心得体会,以及学习linux开发环境的搭建过程(好多次工程崩溃,不知道怎么解决,只能重新来)。

关于本篇文章,以后会将枝节拆分,详细说明。

系统版本

ubuntu16 ubuntu18 版本不是很重要。

新建root

为root用户重置密码,Ubuntu在安装时,应该只是为普通用户进行密码提供,毕竟新安装的系统中配置文件并不允许root直接登录(后面会说)。自己在使用ssh连接时,曾经在这里困顿过很久,才知道是这里的问题。

执行,完成重置密码,即可使用root
sudo passwd root 

允许登录

在自身的配置文件中
sudo vim /etc/ssh/sshd_config
找到  PermitRootLogin 后改为yes
//重启服务即可
sudo /etc/init.d/ssh restart

更新apt-get源

可以先安装vim,然后去修改配置文件。

sudo apt-get install vim

但是并非必须,可以直接使用vi指令。

//备份系统自带源
mv /etc/apt/sources.list /etc/apt/sources.list.bak
//进行编辑
vi /etc/apt/sources.list
//使用阿里源,进行粘贴(Ubuntu18),不同的ubuntu版本使用的源不同,请认真。
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
//Ubuntu16
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

git

//安装git
apt-get install git
//配置项
git config --global user.name "1562..."
git config --global user.email "156..."
/查看
git config --list

python环境

建议:搭建自己的独立的环境 将来做开发可以多版本使用。python的发展太快,对应的包版本同样,这样有些时候可以避免冲突。

//这里下载自己需要的对应的包
tar  -xvf Python-3.6.2.tgz
cd  Python-3.6.2/
./configure --prefix=/opt/python3.6
//执行make指令可能会报错,检查是否自动生成make文件
make
make install
//所导出的文件地址不需要创建,系统自动完成
echo "export PATH=/opt/python3.6/bin:\$PATH" > /etc/profile.d/python.sh
echo $PATH
which python 
mkdir ~/.python-eggs
chmod +w ~/.python-eggs
echo "export PATH=/opt/python3.6/bin:\$PATH" > /etc/profile.d/python.sh
export PATH=/opt/python3.6/bin:$PATH

pip安装对应包

pip可以选择更新源

//根目录创建.pip文件:mkdir ~/.pip
//创建文件pip.conf:vim ~/.pip/pip.conf
//编辑模式
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
//保存退出,直接使用即可

在进行安装时,执行指令

pip3  --default-timeout=100 install  -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

其中,设置默认超时时间,-r 安装文件 -i可以指定源,如果自己的pip没有修改的话。

redis环境

  • 执行命令

sudo apt-get install redis-server -y

  • 检查Redis服务器系统进程

ps -agx|grep redis

  • 端口号6379

netstat -nlt|grep 6379

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
嵌入式Linux环境配置是一个涉及到多个方面的任务,包括选择适合的硬件平台、选择合适的Linux发行版、配置内核和文件系统等等。以下是一个基本的嵌入式Linux环境配置的步骤: 1. 硬件平台选择:根据项目需求选择适合的硬件平台,如Raspberry Pi、BeagleBone等。确保平台具备足够的处理能力和扩展性。 2. Linux发行版选择:根据硬件平台的要求选择合适的Linux发行版,如Debian、Ubuntu、Buildroot等。考虑到嵌入式系统的资源限制,建议选择轻量级的发行版。 3. 内核配置:根据项目需求配置Linux内核。可以使用交叉编译工具链进行内核编译,配置相关选项,如设备驱动、文件系统支持、网络协议等。参考平台提供的文档和社区资源进行配置。 4. 文件系统配置:选择合适的文件系统,如ext4、JFFS2等,并进行相应的配置。文件系统需要包含所需的应用程序、库文件和配置文件等。 5. 交叉编译工具链配置:安装并配置交叉编译工具链,用于编译嵌入式应用程序和驱动程序。交叉编译工具链可以在主机上进行开发,生成针对目标平台的可执行文件。 6. 应用程序开发:使用交叉编译工具链进行应用程序开发,包括编写应用程序代码、编译和调试等。可以使用常见的开发工具,如GCC、Make、GDB等。 7. 调试和测试:使用调试工具和测试框架对嵌入式系统进行调试和测试。可以使用JTAG调试器、串口调试等方式进行硬件和软件调试。 8. 部署和更新:将编译好的文件系统和应用程序部署到目标硬件平台上,并进行系统更新和维护。可以使用工具如TFTP、NFS等进行文件传输和更新。 以上是一个基本的嵌入式Linux环境配置的步骤,具体的配置过程会因项目需求和平台差异而有所不同。建议参考相关的文档和社区资源,以获取更详细的配置指导。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值