f (!empty($uidarr)) {
$uids = array();
$update = array();
foreach ($uidarr as $_uid => $n) {
$uids[] = $_uid;
$update[$_uid] = array('articles-' => $n);
'mysql' != $conf['cache']['type'] and cache_delete('user-' . $_uid);
}
user_big_update(array('uid' => $uids), $update);
}
!empty($operate_create) && function_exists('operate_big_insert') and operate_big_insert($operate_create);
return TRUE;
}
// 大数据量容易超时 删除用户时使用,删除主题 回复 栏目统计 附件 全站统计
function well_thread_delete_all_by_uid($uid)
{
// 用户主题数
$user = user_read_cache($uid);
set_time_limit(0);
// 删除所有回复
if ($user['comments']) {
$postist = comment_pid_find_by_uid($uid, 1, $user['comments'], FALSE);
$pidarr = array();
foreach ($postist as $val) {
$pidarr[] = $val['pid'];
}
unset($postist);
!empty($pidarr) and comment_delete_by_pids($pidarr);
}
if ($user['articles']) {
// 如果主题、附件和回复数量太大会超时
$tidlist = thread_tid_find_by_uid($uid, 1, $user['articles'], FALSE, 'tid', array('tid'));
$tidarr = array();
foreach ($tidlist as $val) {
$tidarr[] = $val['tid'];
}
unset($tidlist);
!empty($tidarr) and well_thread_delete_all($tidarr);
}
return TRUE;
}
// 搜索标题
function well_thread_find_by_keyword($keyword, $d = NULL)
{
if (empty($keyword)) return NULL;
$db = $_SERVER['db'];
$d = $d ? $d : $db;
if (!$d) return FALSE;
$threadlist = db_sql_find("SELECT * FROM `{$d->tablepre}website_thread` WHERE subject LIKE '%$keyword%' LIMIT 60;", 'tid', $d);
if ($threadlist) {
$threadlist = arrlist_multisort($threadlist, 'tid', FALSE);
foreach ($threadlist as &$thread) {
well_thread_format($thread);
// 关键词标色
//$thread['subject'] = comment_highlight_keyword($thread['subject'], $keyword);
}
}
return $threadlist;
}
// 查找 最后评论 lastpid
function well_thread_find_lastpid($tid)
{
$arr = comment_pid_read(array('tid' => $tid), array('pid' => -1), array('pid'));
$lastpid = empty($arr) ? 0 : $arr['pid'];
return $lastpid;
}
// 更新最后的 uid
function well_thread_update_last($tid)
{
if (empty($tid)) return FALSE;
$lastpid = well_thread_find_lastpid($tid);
if (empty($lastpid)) return FALSE;
$lastpost = comment_read($lastpid);
if (empty($lastpost)) return FALSE;
$r = well_thread_update($tid, array('lastuid' => $lastpost['uid']));
return $r;
}
function well_thread_maxid()
{
$n = db_maxid('website_thread', 'tid');
return $n;
}
// 主题状态 0:通过 1~9 审核:1待审核 10~19:10退稿 11逻辑删除
function well_thread_format(&$thread)
{
global $gid, $uid, $forumlist;
$conf = _SERVER('conf');
if (empty($thread)) return;
$thread['create_date_fmt'] = humandate($thread['create_date']);
$thread['last_date_fmt'] = humandate($thread['last_date']);
$thread['create_date_fmt_ymd'] = date('Y-m-d', $thread['create_date']);
$thread['last_date_fmt_ymd'] = date('Y-m-d', $thread['last_date']);
$user = user_read_cache($thread['uid']);
$onlinelist = online_user_list_cache();
$user['online_status'] = isset($onlinelist[$user['uid']]) ? 1 : 0;
$thread['username'] = $user['username'];
$thread['user_avatar_url'] = array_value($user, 'avatar_url');
$thread['user'] = user_safe_info($user);
unset($user);
$forum = array_value($forumlist, $thread['fid']);
$thread['forum_name'] = array_value($forum, 'name');
$thread['forum_url'] = array_value($forum, 'url');
if ($thread['last_date'] == $thread['create_date']) {
$thread['last_date_fmt'] = '';
$thread['lastuid'] = 0;
$thread['lastusername'] = '';
} else {
$lastuser = $thread['lastuid'] ? user_read_cache($thread['lastuid']) : array();
$thread['lastusername'] = $thread['lastuid'] ? $lastuser['username'] : lang('guest');
$thread['lastuser'] = $thread['lastuid'] ? user_safe_info($lastuser) : array();
unset($lastuser);
}
$thread['url'] = url('read-' . $thread['tid'], '', FALSE);
if ($conf['url_rewrite_on'] > 1) {
!empty($forum['well_alias']) and $thread['url'] = url(urlencode($forum['well_alias'])."-$thread[create_date]a$thread[tid]", '', FALSE);
} else {
$thread['url'] = url("read-$thread[create_date]a$thread[tid]", '', FALSE);
}
$thread['user_url'] = url('user-' . $thread['uid']);
$thread['sticky_class'] = '';
if ($thread['sticky'] > 0) {
if (1 == $thread['sticky']) {
$thread['sticky_class'] = 'success';
} elseif (2 == $thread['sticky']) {
$thread['sticky_class'] = 'warning';
} elseif (3 == $thread['sticky']) {
$thread['sticky_class'] = 'danger';
}
}
$nopic = view_path() . 'img/nopic.png';
if ($thread['icon']) {
$attach_dir_save_rule = array_value($conf, 'attach_dir_save_rule', 'Ym');
$day = date($attach_dir_save_rule, $thread['icon']);
$thread_format_icon_default = 1;
if (1 == $thread_format_icon_default) {
// 本地文件绝对路径
$destfile = $conf['upload_path'] . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg';
// 本地
$thread['icon_fmt'] = is_file($destfile) ? file_path($thread['attach_on']) . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg' : $nopic;
if (1 == $conf['attach_on'] && 1 == $thread['attach_on']) {
// 云储存
$thread['icon_fmt'] = file_path($thread['attach_on']) . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg';
} elseif (2 == $conf['attach_on'] && 2 == $thread['attach_on']) {
// 图床 未上传成功 本地图片在的话使用本地,不在则默认
$thread['icon_fmt'] = $thread['image_url'] ? $thread['image_url'] : $thread['icon_fmt'];
}
}
} else {
$thread['icon_fmt'] = $nopic;
}
// 回复页面
$thread['pages'] = ceil($thread['posts'] / $conf['comment_pagesize']);
$thread['tag_fmt'] = $thread['tag'] ? xn_json_decode($thread['tag']) : '';
// 权限判断
$thread['allowupdate'] = ($uid == $thread['uid']) || forum_access_mod($thread['fid'], $gid, 'allowupdate');
$thread['allowdelete'] = (group_access($gid, 'allowuserdelete') and $uid == $thread['uid']) || forum_access_mod($thread['fid'], $gid, 'allowdelete');
$thread['allowtop'] = forum_access_mod($thread['fid'], $gid, 'allowtop');
$thread = well_thread_safe_info($thread);
}
function well_thread_format_last_date(&$thread)
{
if ($thread['last_date'] != $thread['create_date']) {
$thread['last_date_fmt'] = humandate($thread['last_date']);
} else {
$thread['create_date_fmt'] = humandate($thread['create_date']);
}
}
// 对 $threadlist 权限过滤
function well_thread_list_access_filter(&$threadlist, $gid)
{
global $forumlist;
if (empty($threadlist)) return NULL;
foreach ($threadlist as $tid => $thread) {
if (empty($forumlist[$thread['fid']]['accesson'])) continue;
if ($thread['sticky'] > 0) continue;
if (!forum_access_user($thread['fid'], $gid, 'allowread')) {
unset($threadlist[$tid]);
}
}
}
function well_thread_safe_info($thread)
{
unset($thread['userip'], $thread['user']['threads'], $thread['user']['posts'], $thread['user']['credits'], $thread['user']['golds'], $thread['user']['money']);
empty($thread['user']) || $thread['user'] = user_safe_info($thread['user']);
return $thread;
}
// 过滤安全数据
function well_thread_filter(&$val)
{
unset($val['userip'], $val['fid'], $val['flagid'], $val['type'], $val['user'], $val['create_date']);
}
//------------------------ 其他方法 ------------------------
// 集合主题tid,统一拉取,避免多次查询thread表
function thread_unified_pull($arr)
{
global $gid, $fid;
$stickylist = array_value($arr, 'stickylist', array());
$tidlist = array_value($arr, 'tidlist', array());
//$fid = array_value($arr, 'fid');
// 合并过滤空数组
//$tidlist = array_filter($stickylist + $tidlist);
$tidarrlist = $tidlist = $stickylist + $tidlist;
// 版块自定义
list($flaglist, $flagtids) = flag_thread_by_fid($fid);
empty($flagtids) || $tidarrlist += $flagtids;
unset($flagtids);
// 在这之前合并所有二维数组 tid值为键/array('tid值' => tid值)
$tidarr = empty($tidarrlist) ? array() : arrlist_values($tidarrlist, 'tid');
// 在这之前使用array_merge()前合并所有一维数组 tid/array(1,2,3)
if (empty($tidarr)) return NULL;
$tidarr = array_unique($tidarr);
// 主题相关统一遍历后再归类
$arrlist = well_thread_find($tidarr, count($tidarr));
// 过滤没有权限访问的主题 / filter no permission thread
well_thread_list_access_filter($arrlist, $gid);
$threadlist = array();
foreach ($arrlist as $_tid => &$_thread) {
$_thread = well_thread_safe_info($_thread);
// 归类列表数据
isset($tidlist[$_thread['tid']]) and $threadlist[$_tid] = $_thread;
// flag thread
if (!empty($flaglist)) {
foreach ($flaglist as $key => $val) {
if (isset($val['tids']) && in_array($_thread['tid'], $val['tids'])) {
$flaglist[$key]['list'][array_search($_thread['tid'], $val['tids'])] = $_thread;
ksort($flaglist[$key]['list']);
}
}
}
}
// 按之前tidlist排序
$threadlist = array2_sort_key($threadlist, $tidlist, 'tid');
unset($arrlist, $tidlist);
$arr = array('threadlist' => $threadlist, 'flaglist' => $flaglist);
return $arr;
}
// read.php 详情页其他主题调用,集合tid统一拉取数据,最后归类
function thread_other_pull($thread)
{
global $forumlist, $gid;
$fid = array_value($thread, 'fid');
$forum = array_value($forumlist, $fid);
if (empty($forum)) return NULL;
//$tid = array_value($thread, 'tid');
//$tag_fmt = array_value($thread, 'tag_fmt');
$arrlist = array();
$tidlist = array();
// 版块自定义
list($flaglist, $flagtids) = flag_thread_by_fid($fid);
empty($flagtids) || $tidlist += $flagtids;
unset($flagtids);
// 在这之前合并所有二维数组 tid值为键/array('tid值' => tid值)
$tidarr = empty($tidlist) ? array() : arrlist_values($tidlist, 'tid');
// 在这之前使用array_merge()前合并所有一维数组 tid/array(1,2,3)
if (empty($tidarr)) return NULL;
$tidarr = array_unique($tidarr);
// 主题相关统一遍历后再归类
$threadlist = well_thread_find($tidarr, count($tidarr));
// 过滤没有权限访问的主题 / filter no permission thread
well_thread_list_access_filter($threadlist, $gid);
foreach ($threadlist as &$_thread) {
$_thread = well_thread_safe_info($_thread);
// flag thread
if (!empty($flaglist)) {
foreach ($flaglist as $key => $val) {
if (isset($val['tids']) && in_array($_thread['tid'], $val['tids'])) {
$flaglist[$key]['list'][array_search($_thread['tid'], $val['tids'])] = $_thread;
ksort($flaglist[$key]['list']);
}
}
}
}
unset($threadlist);
if (!empty($flaglist)) {
foreach ($flaglist as &$val) {
$i = 0;
if (!isset($val['list'])) continue;
foreach ($val['list'] as &$v) {
++$i;
$v['i'] = $i;
}
}
$arrlist['flaglist'] = $flaglist;
unset($flaglist);
}
return $arrlist;
}
//--------------------------cache--------------------------
// 已格式化 从缓存中读取,避免重复从数据库取数据
function well_thread_read_cache($tid)
{
global $conf;
$key = 'website_thread_' . $tid;
static $cache = array(); // 用静态变量只能在当前 request 生命周期缓存,跨进程需要再加一层缓存:redis/memcached/xcache/apc
if (isset($cache[$key])) return $cache[$key];
if ('mysql' == $conf['cache']['type']) {
$r = well_thread_read($tid);
} else {
$r = cache_get($key);
if (NULL === $r) {
$r = well_thread_read($tid);
$r and cache_set($key, $r, 1800);
}
}
$cache[$key] = $r ? $r : NULL;
return $cache[$key];
}
?>
经典Ubuntu20.04版本U盘安装双系统教程编程频道|福州电脑网
经典Ubuntu20.04版本U盘安装双系统教程
编程之家600
更新时间:2026-04-10 02:34:32
经典Ubuntu20.04版本U盘安装双系统教程
- 1. 前言
- 2. 前提准备
- 2.1 下载Ubuntu 20.04 LTS 镜像
- 2.2 下载安装Win32 Disk Imager工具
- 2.3 制作Ubutun安装盘
- 3. window设置
-
- 4. Ubuntu安装
- 4.1 进入Bios设置U盘启动
- 4.2 MBR分区安装
- 4.3 GPT分区安装
- 5. 总结
Ubutun官网
1. 前言
Ubuntu 建立在Debian的架构和基础架构之上,包括 Linux 服务器、桌面、物联以及云操作系统版本。最近项目需求换成linux的,入手ubuntu桌面比较简洁美观并且作为生产系统生态良好,开始了着手查找安装Ubuntu双系统的方法和视频,安装有两种:
| 🎈方法 | 🎈特点 | 🎈定义 |
|---|
| 虚拟机安装 | 安全性高,可以双开 | 通过软件模拟完成硬件,运行在一个完全隔离的环境中,不会对原系统产生影响 |
| U盘安装 | 性能释放,相互访问 | 将两个系统分别安装在同一台电脑的不同分区内,相互影响 |
- 第一种发挥不出硬件本身的性能,尝鲜还行;
- 算法学习推荐使用第二种,慢慢相互影响,命运与共。
如果你的网络可以进国外网站下载,你可以直接去官网第一手资源,否则就看下面的教程喽!
2. 前提准备
大于8G的U盘一个(提前备份数据,然后清空)
2.1 下载Ubuntu 20.04 LTS 镜像
官网地址:https://cn.ubuntu/download
推荐下载地址:清华源下载ubuntu-20.04.5-desktop-amd64.iso
- 选择Ubutun的20.04.5 (amd64, Desktop LiveDVD)下载
2.2 下载安装Win32 Disk Imager工具
该程序旨在将原始磁盘映像写入可移动设备或将可移动设备备份到原始映像文件。它对于嵌入式开发非常有用,即 Arm 开发项目(Android、Ubuntu on Arm 等)。
- 然后就有第二个下载的工具安装第一个下载的Ubutun系统
2.3 制作Ubutun安装盘
视频:
- 选择镜像文件Ubutun文件,此处K盘为U盘,其他不管直接写入,点击Yes继续,等待烧写完成。
- 烧写完成
3. window设置
3.1 磁盘分区
视频:
分出一个空的区域给ubuntu系统做存储。在桌面上,点击计算机图标(右键)–> 管理 --> 找到磁盘管理,之后找一个比较大的硬盘分区点击一下,大约需要40G空间。如果你的可以分出更多,按照这个比例划分就好🏃♂️🏃♂️🏃♂️
| 分区 | (引导区)efi | (内存交换区)swap | (根挂载点C盘) / | (非系统盘) /home |
|---|
| 功能 | 开机选择系统引导文件 | 计算机运行交互产生数据暂存区域 | 安装系统软件位置 | 存放用户数据 |
| 大小分配 | 500MB | 10000MB | 20000MB | 11450MB |
注意引导区efi要求在C盘(分出500MB),其他分区可在C盘外(分出40G)
- 方案一适用于磁盘空间大的
- 方案二适用于磁盘空间小的
输入需要压缩的空间,就能得到一个对应的空余空间用来当做ubuntu系统盘。
3.2 查看计算机磁盘格式
视频:
4. Ubuntu安装
Ubuntu安装分为两种MBR分区和GPT分区两种,大家按需就位💖💖💖
4.1 进入Bios设置U盘启动
-
开机或重启,根据常用的品牌,我的是华硕笔记本狂按F2,进入Bios的设置,下面给出对应启动键表,方便大家自查!😀😀😀
-
一般电脑设置保护,在BIOS里面的Security,把Security Boot由Enable改为Disable
-
在开始设置setup中,UEFI/Legacy Boot选择Legacy Only模式,然后ESC退出保存
详细了解可以查看这篇文章
4.2 MBR分区安装
视频
进入安装
- U盘启动后会出现黑色界面的引导界面。
- 进入到ubuntu安装界面、选择中文,点击安装Ubutun。
-
选择English US键盘布局
-
连接网络
相连WiFi就连,后面也可以
- 选择正常安装,不建议把下面两个选项也勾上,勾上容易下载识别导致故障。
-
选择安装类型,**这里我们自定义安装,选择其他选项。**如果不想折腾也可以简单选择第一个选项。
-
分区,这是最重要的一点,前面我们预留了硬盘空间这里就用上了,我们点击空余空间,点 + 号新建分区。
这里我们要分四个区域,分别是
-
注意如果你是多磁盘,必须选择boot区域启动,否则会有bug,之后点击 现在安装继续 即可。
-
选择上海时区
-
选择用户设置,小巧简洁就好
-
等安装完成以后点重启,点击现在重启
-
然后把U盘拔下来,按回车键就重启了。
-
选择第一项为Ubutun启动,最后一项为Windows启动
-
点击前进,选择否,然后一直前进,就顺利安装👻👻👻
4.3 GPT分区安装
视频
前期操作可以参照MRT分区安装。只有第七步有差异。
- 分区
- 有两点不同,第一点原先的/boot分区现在是EFI系统分区
- 第二点修改EFI分区的引导器与之对应,这里p5对p5
5. 总结
非常感谢各位大佬的支持,特别是《机器人工匠阿杰》UP主,到这里经典Ubuntu20.04版本U盘安装双系统教程就算完成了。大家快去探索Ubuntu系统的乐趣吧!🥳🥳🥳我们实现对外部世界进行感知🎏,充分认识这个有机与无机的环境🌻,科学地合理地进行创作和发挥效益🛹,然后为人类社会发展贡献一点微薄之力。🏃♂️🏃♂️🏃♂️
参考文献:
Ubuntu20.04安装详细图文教程(双系统)
史上最全最新Ubuntu20.04安装教程(图文)
Windows 和 Ubuntu 双系统的安装和卸载
Ubuntu 20.04 安装微信、QQ等
Windows10安装或重装ubuntu18.04双系统教程(平民教程)
本文发布于:2024-10-05,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:双系统版本教程经典
发布评论