termux_ubuntu 系统配置

1、添加新用户

由于 termux/ubuntu 默认创建和登录的是 root 用户,root 用户的 home 目录在 /root 下,这个使用起来很不方便,使用 root 用户也不太习惯,有必要创建新用户

# 创建新用户
useradd -d /home/new_user_name -m new_user_nem	# 新用户 home 目录是 /home/new_user_name,新用户用户名是 -m 后的 new_user_name# 切户到新建的用户
su new_user_name
cd	# 进入 new_user_name 的 home 目录
# 设置新用户密码
passwd new_user_name
whoami	# 查看当前用户

2、安装图形桌面

桌面环境没什么额外的用途,只是徒增资源消耗,就不装了。大部分的开发需求都可以通过在电脑安装的 vscode 使用 ssh 远程连接满足

3、环境配置

  • 切换 shell 为 bash

    termux 默认使用 sh shell,使用起来会很不习惯,可以切换为习惯的 shell

    # 查看当前 shell
    echo $SHELL	# 通用
    echo $0		# 部分 shell 不支持# 查看系统中安装了哪些shell
    cat /etc/shells
    # termux ubuntu 一般默认有 /bin/sh /bin/bash /bin/rbash /bin/dash 等 shell# 通过修改 /etc/passwd文件来修改用户的默认 shell
    vim /etc/passwd
    # 把文件中对应用户的那一行最后的 shell 修改为目标 shell
    # 重新登录用户即可
    
  • 更换镜像源(在 termux ubuntu 中不需要在更换源,更换后可能会导致装软件的时候无法定位到对应的包)

    # 备份镜像源列表
    cp /etc/apt/sources.list /etc/apt/sources.list.bk
    # 编辑镜像源列表文件,这里替换的是中科大的镜像源
    #  中科大源
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse# 国内的其他源
    #  阿里源
    deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse# 清华源deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiversedeb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiversedeb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiversedeb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiversedeb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiversedeb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse#deb cdrom:[Ubuntu 20.04.3 LTS _Focal Fossa_ - Release amd64 (20210819)]/ focal main restricted# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://cn.archive.ubuntu.com/ubuntu/ focal main restricted
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal main restricted## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team. Also, please note that software in universe WILL NOT receive any
    ## review or updates from the Ubuntu security team.
    deb http://cn.archive.ubuntu.com/ubuntu/ focal universe
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal universe
    deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates universe
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates universe## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
    ## team, and may not be under a free licence. Please satisfy yourself as to 
    ## your rights to use the software. Also, please note that software in 
    ## multiverse WILL NOT receive any review or updates from the Ubuntu
    ## security team.
    deb http://cn.archive.ubuntu.com/ubuntu/ focal multiverse
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal multiverse
    deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates multiverse
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates multiverse## N.B. software from this repository may not have been tested as
    ## extensively as that contained in the main release, although it includes
    ## newer versions of some applications which may provide useful features.
    ## Also, please note that software in backports WILL NOT receive any review
    ## or updates from the Ubuntu security team.
    deb http://cn.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse## Uncomment the following two lines to add software from Canonical's
    ## 'partner' repository.
    ## This software is not part of Ubuntu, but is offered by Canonical and the
    ## respective vendors as a service to Ubuntu users.
    # deb http://archive.canonical.com/ubuntu focal partner
    # deb-src http://archive.canonical.com/ubuntu focal partnerdeb http://security.ubuntu.com/ubuntu focal-security main restricted
    # deb-src http://security.ubuntu.com/ubuntu focal-security main restricted
    deb http://security.ubuntu.com/ubuntu focal-security universe
    # deb-src http://security.ubuntu.com/ubuntu focal-security universe
    deb http://security.ubuntu.com/ubuntu focal-security multiverse
    # deb-src http://security.ubuntu.com/ubuntu focal-security multiverse# This system was installed using small removable media
    # (e.g. netinst, live or single CD). The matching "deb cdrom"
    # entries were disabled at the end of the installation process.
    # For information about how to configure apt package sources,
    # see the sources.list(5) manual.
  • a wrong operation

    当使用新添加的用户使用 apt 安装软件的时候,可能会出现报错

    这个可能和 termux 对多用户支持不好有关,因此还是不要使用新用户了,避免掉进其他的坑,直接使用 root 吧

    使用 root 安装软件则没有这个问题

  • 更新 pip 源

    # 注意使用 root 用户
    cd
    mkdir .pip
    vim ~/.pip/pip.conf
    # 文件中添加内容
    [global]
    index-url = http://pypi.douban.com/simple
    [install]
    trusted-host=pypi.douban.com
  • 常用工具安装

    • sudo apt install net-tools

    • sudo apt install gcc

    • sudo apt install g++

    • sudo apt install cmake

    • apt install pipx

      安装这个包的原因主要是在使用 pip 安装 python 包的时候,可能会有报错

      安装完 pipx 之后,将其添加到 PATHpipx ensurepath

      接下来就可以使用 pipx install package_nme来安装 python 包

      另外,也可以强行安装

      pip install --upgrade  --force-reinstall package_name --break-system-packages
      

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/577934.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

VD6283TX环境光传感器(1)----获取光强和色温

VD6283TX环境光传感器.1--获取光强和色温 概述视频教学样品申请完整代码下载主要特点硬件准备技术规格系统框图生成STM32CUBEMX串口配置IIC配置X-CUBE-ALS演示结果光强测试表 概述 为了充分利用VD6283TX传感器的特性和功能,本章节重点介绍了如何捕获光强度和相关色…

Typescript新手入门1

You: Typescript教程 ChatGPT: TypeScript 是一种由微软开发的开源编程语言,它是 JavaScript 的一个超集,添加了可选的静态类型和基于类的面向对象编程。由于您可能正在使用 Linux 系统(Ubuntu 22.04),这对于学习和使…

QT foreach

原型:foreach(variable, container) container:容器,即被遍历的对象 variable:当前元素,即遍历container过程中,当前的那个元素 代码: QStringList container { "1", "2&quo…

JVM 类加载子系统

1. 前言 ​ 虚拟机就是一款用来执行虚拟计算机指令的计算机软件。它相当于一台虚拟计算机。大体上,虚拟机分为系统虚拟机和程序虚拟机。系统虚拟机就相当于一台物理电脑,里面可以安装操作系统;程序虚拟机是为了执行单个计算机程序而设计出来…

Linux文件编程

目录 1、Linux系统提供的文件编程API 1.1打开文件:open 1.2创建文件creat函数 1.3写入文件write函数 1.4读取文件read函数 1.5文件光标位置lseek函数 2、另外一组文件编程API 2.1文件打开函数fopen 2.2读文件函数fread 2.3写文件函数fwrite 2.4文件光标位…

vscode中使用GitHub Copilot Chat

文章目录 一、什么是Github Copilot Chat二、安装使用三、如何使用1. 聊天功能2. 内联功能 一、什么是Github Copilot Chat GitHub Copilot Chat 由 OpenAI 的 GPT-4 大型多模态模型提供支持,能带来更准确的代码建议、解释和指导。GitHub Copilot Chat 的内联功能可…

手机上的软件怎么修改网络IP地址

在手机上修改网络IP地址通常需要通过以下两种方法: 1. 使用VPN(虚拟私人网络)或代理软件: 步骤如下: - 下载并安装一个可靠的VPN或代理软件到你的手机上。 - 打开VPN或代理软件,选择一个你希望获取IP地址…

计算机毕业设计 基于SpringBoot的高校宣讲会管理系统的设计与实现 Java实战项目 附源码+文档+视频讲解

博主介绍:✌从事软件开发10年之余,专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌ 🍅文末获取源码联系🍅 👇🏻 精…

关于Python里xlwings库对Excel表格的操作(十九)

这篇小笔记主要记录如何【取消合并单元格】。 前面的小笔记已整理成目录,可点链接去目录寻找所需更方便。 【目录部分内容如下】【点击此处可进入目录】 (1)如何安装导入xlwings库; (2)如何在Wps下使用xlwi…

vue2、vue3实现用aws s3协议操作minio进行文件存储和读取

亚马逊s3 API文档 最开始安装了aws-sdk/client-s3,但是不知道为什么一直报错,所以用了aws-sdk 准备工作: 需要已经搭建好minio、创建好桶 1. vue2 安装插件 yarn add aws-sdk s3配置 var AWS require("aws-sdk"); AWS.co…

解析翻页设计的最佳实践和后端设计概要

文章目录 解析翻页设计的最佳实践和后端设计概要缘起BFF评审中的翻页问题AuditLog翻页问题的处理分页设计思考 关键点总结进一步思考 解析翻页设计的最佳实践和后端设计概要 缘起 在技术开发过程中,翻页操作的设计常常涉及到多种需求和技术考量。回顾最近的讨论和…

阿里云 ECS Docker、Docker Compose安装

https://help.aliyun.com/document_detail/51853.html https://docs.docker.com/compose/install/ Centos https://blog.csdn.net/Alen_xiaoxin/article/details/104850553 systemctl enable dockerdocker-compose安装 https://blog.csdn.net/qq465084127/article/details/…

CentOS 8.2 安装 Mysql 5.7.26(单机)

Mysql二进制包: mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz 1、卸载旧环境 rpm -qa|grep mysql rpm -qa|grep mariadb rpm -e XXX.rpm --nodeps # 强制卸载rpm包 rm -rf /etc/my.cnf rm -rf /etc/mysql rm -rf /usr/local/mysql 2、安装依赖包 yum -y install libaio yum…

vscode括号颜色突然变成白色的了,怎么解决

更新版本后发现vscode的各种括号都变成了白色,由于分色括号已经使用习惯,突然变成白色非常不舒服,尝试多次后,为大家提供一下几种解决方式,希望能帮到同样受到此种困惑的你: 第一种: 首先打开…

WebGL开发建筑和设计教育应用

使用 WebGL 开发建筑和设计教育应用可以为学生提供沉浸式的三维体验,使他们能够在虚拟环境中探索建筑结构、材料和设计理念。以下是开发建筑和设计教育应用的一般步骤,希望对大家有所帮助。北京木奇移动技术有限公司,专业的软件外包开发公司&…

计算机视觉基础(13)——深度估计

前言 本节是计算机视觉的最后一节,我们将学习深度估计。从深度的概念和度量入手,依次学习单目深度估计和双目/多目深度估计,需要知道深度估计的经典方法,掌握深度估计的评价标准,注意结合对极几何进行分析和思考。 一、…

【LeetCode刷题笔记】动态规划(四)

背包问题 0-1 背包问题 有一个背包,它的容量为 C现在有 n 种不同的物品,他们的编号分别是 0...n-1。每一种物品只有一个。在这 n 种物品中,第 i 个物品的重量是 w[i],它的价值为 v[i]问题是:可以向这个背包中放哪些物品,使得在不超过背包容量的基础上,背包中物品的总价…

【华为OD题库-110】反转每对括号间的子串-java

题目 给出一个字符串s(仅含有小写英文字母和括号)。 请你按照从括号内到外的顺序,逐层反转每对匹配括号中的字符串,并返回最终的结果。注意,您的结果中不应包含任何括号。 示例1: 输入: s “(abcd)” 输出: “dcba” 示例2: 输入: s “(u(l…

MongoDB视图的修改与删除

目录 修改视图 删除视图 视图,为mongodb的操作和数据安全上提供了便利。但伴随着业务逻辑的发展或数据库维护人员操作当中产生的错误,视图难免需要维护修改。例如增加字段,修改视图中的计算逻辑等。 修改视图 查询mongodb的官方文档&…

Linux的基本命令

文章目录 grep的基本查询grep的高亮查询 grep的基本查询 grep命令可以用于在文件中查找指定内容,并将包含该内容的行打印出来。以下是几种不同的实现方法: 使用基本语法格式: (1)grep “要查找的内容” 文件名 例如…