Aptitude cache backup howto

It will depend on the reader to judge how useful this is or if it is useful at all, but I do use it from time to time.

Whether you want to re install the same version of Ubuntu or you want to install it on a different machine this will save you some set up time.

The first time you install Ubuntu, if you do this one or two moths after release, you will notice that you need to install over 100 MB of packages updates and if you’ve been using it for a while you’ve already installed and updated the software you need. Well, I sometimes need to re install Ubuntu, because I messed it up and I’m too lazy to fix it or because I want it on a different computer.

You may have noticed that if you install a package via aptitude (or apt-get or Synaptic Package Manager) it downloads it from the net but if you uninstall it and later install it again it will not be downloaded and instead installed from the local cache. Much faster of course.

With this little scripts you can make this happen on a clean Ubuntu install saving you some downloading time. And probably some boredom as well.

To get started fire up a terminal.

First back up you cache:

mkdir -p ~/backup/var/lib/

sudo cp -R /var/lib/apt/ ~/backup/var/lib/

mkdir -p ~/backup/var/cache/

sudo cp -R /var/cache/apt/ ~/backup/var/cache/

mkdir -p ~/backup/etc/apt

sudo cp -R /etc/apt/ ~/backup/etc/

sudo chown -R $USER ~/backup

That will copy the apt cache and config to a “backup” folder within your home directory. Feel free to change that to whatever suits you best.

The you must, of course, copy that to some other media to either transfer to another computer or keep safe while you reinstall.

Now the restore process:

sudo cp -fR ~/backup/var/* /var/

sudo cp -fR ~/backup/etc/apt/* /etc/apt/

That will restore the files from the origin to the real location. After that run aptitude update and you are ready to install anything you had previously installed without the need to download it all over again. Including updates!

NOTE: this assumes that everything is back in your home directory. If this is not the case change “~” for the full path of the actual location.

Well hope this works for you!

From thie link you can get two scripts to do this. To use then un tar the file (tar -zxf aptitude-backup.tar.bz) and give then execution permission and then just run then with the location for the back up or restore from path as a parameter.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
内容介绍 项目结构: Controller层:使用Spring MVC来处理用户请求,负责将请求分发到相应的业务逻辑层,并将数据传递给视图层进行展示。Controller层通常包含控制器类,这些类通过注解如@Controller、@RequestMapping等标记,负责处理HTTP请求并返回响应。 Service层:Spring的核心部分,用于处理业务逻辑。Service层通过接口和实现类的方式,将业务逻辑与具体的实现细节分离。常见的注解有@Service和@Transactional,后者用于管理事务。 DAO层:使用MyBatis来实现数据持久化,DAO层与数据库直接交互,执行CRUD操作。MyBatis通过XML映射文件或注解的方式,将SQL语句与Java对象绑定,实现高效的数据访问。 Spring整合: Spring核心配置:包括Spring的IOC容器配置,管理Service和DAO层的Bean。配置文件通常包括applicationContext.xml或采用Java配置类。 事务管理:通过Spring的声明式事务管理,简化了事务的处理,确保数据一致性和完整性。 Spring MVC整合: 视图解析器:配置Spring MVC的视图解析器,将逻辑视图名解析为具体的JSP或其他类型的视图。 拦截器:通过配置Spring MVC的拦截器,处理请求的预处理和后处理,常用于权限验证、日志记录等功能。 MyBatis整合: 数据源配置:配置数据库连接池(如Druid或C3P0),确保应用可以高效地访问数据库。 SQL映射文件:使用MyBatis的XML文件或注解配置,将SQL语句与Java对象映射,支持复杂的查询、插入、更新和删除操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值