Cobbler

Stella981
• 阅读 450

1. cobbler简介

cobbler官网:http://cobbler.github.io/
Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。
Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。
Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。

2、cobbler集成的服务

  • PXE服务支持
  • DHCP服务管理
  • DNS服务管理(可选bind,dnsmasq)
  • 电源管理
  • Kickstart服务支持
  • YUM仓库管理
  • TFTP(PXE启动时需要)
  • Apache(提供kickstart的安装源,并提供定制化的kickstart配置)

3、cobbler配置文件详解

cobbler配置文件目录在/etc/cobbler

配置文件                                                                        作用
/etc/cobbler/settings                                    cobbler 主配置文件
/etc/cobbler/iso/                                              iso模板配置文件
/etc/cobbler/pxe                                            pxe模板配置文件
/etc/cobbler/power                                      电源配置文件
/etc/cobbler/user.conf                               web服务授权配置文件
/etc/cobbler/users.digest                               web访问的用户名密码配置文件
/etc/cobbler/dhcp.template                       dhcp服务器的的配置模板
/etc/cobbler/dnsmasq.templat e              dns服务器的配置模板
/etc/cobbler/tftpd.template                         tftp服务的配置模板
/etc/cobbler/modules.conf                           模块的配置文件
  • cobbler数据目录

    目录                                                                               作用
    /var/lib/cobbler/config/                         用于存放distros,system,profiles等信息配置文件
    /var/lib/cobbler/triggers/                    用于存放用户定义的cobbler命令
    /var/lib/cobbler/kickstart/                   默认存放kickstart文件
    /var/lib/cobbler/loaders/                      存放各种引导程序以镜像目录
    /var/www/cobbler/ks_mirror/            导入的发行版系统的所有数据
    /var/www/cobbler/images/                 导入发行版的kernel和initrd镜像用于远程网络启动
    /var/www/cobbler/repo_mirror/        yum仓库存储目录
    
  • cobbler的日志文件

    日志文件路径                                              说明
    /var/log/cobbler/installing             客户端安装日志
    /var/log/cobbler/cobbler.log            cobbler日志
    
  • cobbler命令详解

    cobbler check            //核对当前设置是否有问题
    cobbler list                //列出所有的cobbler元素
    cobbler report           //列出元素的详细信息
    cobbler sync            //同步配置到数据目录,更改配置最好都要执行下
    cobbler reposync     //同步yum仓库
    cobbler distro          //查看导入的发行版系统信息
    cobbler system        //查看添加的系统信息
    cobbler profile         //查看配置信息
    

4.cobbler 部署

4.2cobbler 部署

//关闭防火墙
[root@localhost ~]# systemctl  stop  firewalld
[root@localhost ~]# systemctl  disable  firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# vim  /etc/selinux/config
 **//将第六行中的 enforcing 改为 disabled**
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled      

[root@localhost ~]# setenforce   0

//配置yum源
//下载之前请确保电脑有网和本地仓库可用
//163网络源下载好后请将原来的源移走或删除
[root@localhost yum.repos.d]# yum  install  -y  wget
[root@server ~]#  curl -o /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@server ~]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo 
[root@server ~]# sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/CentOS7-Base-163.repo 
[root@server ~]# yum install -y epel-release

//安装cobbler以及相关的软件
[root@server ~]#  yum -y install httpd dhcp tftp python-ctypes cobbler xinetd cobbler-web pykickstart

//启动服务并设置开机自启
[root@server ~]# systemctl start httpd
[root@server ~]# systemctl start cobblerd
[root@server ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@sever ~]# systemctl enable cobblerd
Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.

//修改server的ip地址为本机ip
[root@server ~]# sed -i 's/^server: 127.0.0.1/server: 192.168.66.130/' /etc/cobbler/settings

//设置tftp的ip地址为本机ip
[root@server ~]# sed -i 's/^next_server: 127.0.0.1/next_server: 192.168.66.130/' /etc/cobbler/settings 

//开启tftp
[root@server ~]# sed -i '/disable/s/yes/no/g' /etc/xinetd.d/tftp

//下载缺失文件
[root@server ~]# cobbler get-loaders
task started: 2020-05-28_172454_get_loaders
task started (id=Download Bootloader Content, time=Thu May 28 17:24:54 2020)
downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***

//启动rsync并设置开机自启
[root@server ~]# systemctl start rsyncd
[root@server ~]# systemctl enable rsyncd
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.

//生成加密的密码
[root@server ~]#  openssl passwd -1 -salt "$RANDOM" 'wlw123!'
$1$30214$snHY66HJF6ZeMh8ul1eW..//这是密码加密后的形式

//将新生成的加密密码加入到配置文件
[root@server ~]# vim /etc/cobbler/settings
//修改密码
default_password_crypted: "$1$30214$snHY66HJF6ZeMh8ul1eW.."

//重启cobbler
[root@server ~]# systemctl restart cobblerd
[root@server ~]# ss -antl
State      Recv-Q Send-Q            Local Address:Port                           Peer Address:Port              
LISTEN     0      128                           *:22                                        *:*                  
LISTEN     0      100                   127.0.0.1:25                                        *:*                  
LISTEN     0      5                     127.0.0.1:25151                                     *:*                  
LISTEN     0      5                             *:873                                       *:*                  
LISTEN     0      128                          :::80                                       :::*                  
LISTEN     0      128                          :::22                                       :::*                  
LISTEN     0      100                         ::1:25                                       :::*                  
LISTEN     0      128                          :::443                                      :::*                  
LISTEN     0      5                            :::873                                      :::*    

//通过cobbler check 核对当前设置是否有问题
//要是有Seliux错误要重启虚拟机
[root@wan ~]# cobbler check
The following are potential configuration items that you may want to fix:

1 : debmirror package is not installed, it will be required to manage debian deployments and repositories
2 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

Restart cobblerd and then run 'cobbler sync' to apply changes.
//以上两个是关于debian系统的错误,请忽略

//配置cobbler dhcp
//修改cobbler配置文件,让cobbler控制dhcp
[root@wan ~]# sed -i '/^manage_dhcp/s/0/1/g' /etc/cobbler/settings
[root@wan ~]# sed -n '/^manage_dhcp/p' /etc/cobbler/settings
manage_dhcp: 1

//配置dhcp
[root@wan ~]# vim /etc/cobbler/dhcp.template
subnet 192.168.66.0 netmask 255.255.255.0 {
     option routers             192.168.66.2;   // 指定网关
     option domain-name-servers 192.168.66.2;   // 此处为系统安装好后指定的dns地址
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.66.100 192.168.66.200;    // 分配的ip地址范围(批量安装机子,最多252,253台)
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;

//重启服务并同步配置,改完dhcp必须要sync同步配置
[root@wan ~]# systemctl restart cobblerd
[root@wan ~]# cobbler sync
.......
*** TASK COMPLETE ***       #最后出现这个表示正常

//检查dhcp是否正常
[root@wan ~]# netstat -anulp | grep dhcp
udp        0      0 0.0.0.0:67              0.0.0.0:*                           1392/dhcpd          
//导入redhat7镜像
[root@wan ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@wan ~]# cobbler import --path=/mnt --name=rhel-7 --arch=x86_64
.......
*** TASK COMPLETE ***       #最后出现这个表示正常

# 说明:
    --path      //镜像路径
    --name      //为安装源定义一个名字
    --arch      //指定安装源平台
//安装源的唯一标示就是根据name参数来定义,本例导入成功后,安装源的唯一标示就是CentOS-7-x86_64,如果重复,系统会提示导入失败

//查看cobbler镜像列表
[root@wan ~]# cobbler list
distros:
   rhel-7-x86_64

profiles:
   rhel-7-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

//创建kickstarts自动安装脚本
[root@wan ~]# cat > /var/lib/cobbler/kickstarts/rhel-7-x86_64.ks <<'EOF'
auth --enableshadow --passalgo=sha512
bootloader --location=mbr
clearpart --all --initlabel
part /boot --asprimary --fstype="ext4" --size=500
part swap --fstype="swap" --size=4096
part / --fstype="ext4" --grow --size=15000
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
url --url=http://192.168.66.130/cobbler/ks_mirror/rhel-7-x86_64
$yum_repo_stanza
reboot

## 此处密码应为本机系统anaconda-ks.cfg文件里的 # Root password
rootpw --iscrypted $6$2WTFvfNvAMgCUPuC$MJgWGzhakgxrRObcEbAwSe8vkz0s//xyiTllGwxRsHHruQhcskO69u2LVTU9u0eemHXH2pzcGawyAJ54R2E/x0

selinux --disabled
skipx
timezone Asia/Shanghai --isUtc --nontp
install
zerombr

%packages
@^minimal
@core
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
EOF
# 检查ks文件语法是否有误
[root@localhost ~]# cobbler validateks
task started: 2018-08-21_171616_validateks
task started (id=Kickstart Validation, time=Tue Aug 21 17:16:16 2018)
----------------------------
osversion: rhel7
checking url: http://192.168.100.96/cblr/svc/op/ks/profile/rhel-7-x86_64
running: /usr/bin/ksvalidator -v "rhel7" "http://192.168.100.96/cblr/svc/op/ks/profile/rhel-7-x86_64"
received on stdout:
received on stderr:
*** all kickstarts seem to be ok ***
*** TASK COMPLETE ***

# 查看当前cobbler有哪些配置文件
[root@localhost ~]# cobbler profile list
   rhel-7-x86_64

# 修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@localhost ~]# cobbler profile edit --name rhel-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/rhel-7-x86_64.ks

# 配置网卡名称为传统网卡名称eth0
[root@localhost ~]# cobbler profile edit --name rhel-7-x86_64 --kopts='net.ifnames=0 biosdevname=0'

# 检查当前系统cobbler配置文件信息
[root@localhost ~]# cobbler profile report
Name                           : rhel-7-x86_64
TFTP Boot Files                : {}
Comment                        :
DHCP Tag                       : default
Distribution                   : rhel-7-x86_64        //仓库名字
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {'biosdevname': '0', 'net.ifnames': '0'}       //网卡设为传统命名方式
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/rhel-7-x86_64.ks     //使用的kickstarts配置文件的路径,必须为我们新建的ks文件的路径
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 :
Internal proxy                 :
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      :
Virt RAM (MB)                  : 512
Virt Type                      : kvm

# 同步cobbler
[root@localhost ~]# cobbler sync
.......
*** TASK COMPLETE ***       ##出现此表示成功

# 为避免发生未知问题,先把服务端所有服务重启
[root@localhost ~]# systemctl restart xinetd
[root@localhost ~]# systemctl restart cobblerd
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# ss -antl
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port
LISTEN     0      128            *:22                         *:*
LISTEN     0      100    127.0.0.1:25                         *:*
LISTEN     0      5      127.0.0.1:25151                      *:*
LISTEN     0      5              *:873                        *:*
LISTEN     0      128           :::80                        :::*
LISTEN     0      128           :::22                        :::*
LISTEN     0      100          ::1:25                        :::*
LISTEN     0      128           :::443                       :::*
LISTEN     0      5             :::873                       :::*

5.客户端安装系统

手动验证:
创建一个虚拟机,模式和服务端模式一样,(这里我使用的是nat,所以要安装的虚拟机模式也是nat),然后设置虚拟机
Cobbler
然后,直接开启虚拟机,看到以下界面,选择第二个,回车,然后等待系统自动安装完成即可。
Cobbler
因为这种方式需要手动选择,如果机器太多,每台服务器都要选择,还是很麻烦,所以采用web界面配置定制安装

# 配置完成后可能导致访问不了web页面,猜测python-django版本有问题
[root@localhost ~]# yum -y install python2-pip
[root@localhost ~]#  pip install --upgrade pip
[root@localhost ~]# pip install Django==1.9.13
#用pip安装指定版本的Django

重启httpd服务 ,再次访问https://192.168.100.96/cobbler\_web出现登录页面
Cobbler

6.定制安装

定制安装步骤:

  • 统计服务器mac地址

  • 配置cobbler

  • 安装

    6.1 获取mac地址

    mac地址在:虚拟机—编辑此虚拟机—网路适配器—高级—MAC地址(点击生成然后复制即可)
    Cobbler Cobbler Cobbler Cobbler

    6.2 配置cobbler

  • 直接在浏览器上搜索:https://本机ip+/cobbler_web

  • 用户名与密码都是cobbler
    Cobbler Cobbler Cobbler Cobbler Cobbler

6.3 安装

直接开启此虚拟机,它就会自动安装
Cobbler
Cobbler Cobbler

编写脚本部署cobbler服务端

#!/bin/bash
#配置yum源
curl -o /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo
sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/CentOS7-Base-163.repo
yum install -y epel-release

#安装cobbler以及相关的软件
yum -y install httpd dhcp tftp python-ctypes cobbler xinetd cobbler-web pykickstart

#启动服务并设置开机自启
systemctl start httpd
systemctl start cobblerd
systemctl enable httpd
systemctl enable cobblerd

#关闭防火墙
firewall()
{
systemctl stop firewalld
systemctl disable firewalld
systemctl mask firewalld
setenforce 0
}

#修改server的ip地址为本机ip
sed -i 's/^server: 127.0.0.1/server: 192.168.66.130/' /etc/cobbler/settings

#设置tftp的ip地址为本机ip
sed -i 's/^next_server: 127.0.0.1/next_server: 192.168.66.130/' /etc/cobbler/settings

#开启tftp
sed -i '/disable/s/yes/no/g' /etc/xinetd.d/tftp
#下载缺失文件
cobbler get-loaders

#启动rsync并设置开机自启
systemctl start rsyncd
systemctl enable rsyncd

#生成加密密码并添加到配置文件
configure_passwd()
{
if [$? -eq 0];then
passwd=`openssl passwd -1 -salt "$RANDOM" 'wlw123!'`
sed -i "101idefault_password_crypted: \"$pass\"" /etc/cobbler/settings
sed -i '102d' /etc/cobbler/settings
fi
}
#重启cobbler
systemctl restart cobblerd
#配置cobbler dhcp
#修改cobbler配置文件,让cobbler控制dhcp
sed -i '/^manage_dhcp/s/0/1/g' /etc/cobbler/settings
sed -n '/^manage_dhcp/p' /etc/cobbler/settings

#配置cobbler dhcp
configure_dhcp()
{
if [$? -eq 0];then
sed -i '21s/192.168.1/192.168.66/g' /etc/cobbler/dhcp.template
sed -i '22s/192.168.1.5/192.168.66.2/g' /etc/cobbler/dhcp.template
sed -i '23s/192.168.1.1/192.168.66.2/g' /etc/cobbler/dhcp.template
sed -i '25s/192.168.1.100 192.168.1.254/192.168.66.100 192.168.66.200/' /etc/cobbler/dhcp.template
fi
}

#重启服务并同步配置,改完dhcp必须要sync同步配置
systemctl restart cobblerd
cobbler sync
main()
{
    firewall&&configure_cobbler&&configure_passwd&&configure_dhcp
}
#导入redhat7镜像
mount /dev/cdrom /mnt/
cobbler import --path=/mnt --name=rhel-7 --arch=x86_64

#提取root密码
root=`awk 'NR==23{print}' anaconda-ks.cfg`

#创建kickstarts自动安装脚本
cat > /var/lib/cobbler/kickstarts/rhel-7-x86_64.ks <<'EOF'
auth --enableshadow --passalgo=sha512
bootloader --location=mbr
clearpart --all --initlabel
part /boot --asprimary --fstype="ext4" --size=500
part swap --fstype="swap" --size=4096
part / --fstype="ext4" --grow --size=15000
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
url --url=http://192.168.66.130/cobbler/ks_mirror/rhel-7-x86_64
$yum_repo_stanza
reboot

## 此处密码应为本机系统anaconda-ks.cfg文件里的 # Root password
rootpw --iscrypted $6$2WTFvfNvAMgCUPuC$MJgWGzhakgxrRObcEbAwSe8vkz0s//xyiTllGwxRsHHruQhcskO69u2LVTU9u0eemHXH2pzcGawyAJ54R2E/x0

selinux --disabled
skipx
timezone Asia/Shanghai --isUtc --nontp
install
zerombr

%packages
@^minimal
@core
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
EOF

# 修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
cobbler profile edit --name rhel-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/rhel-7-x86_64.ks

# 配置网卡名称为传统网卡名称eth0
cobbler profile edit --name rhel-7-x86_64 --kopts='net.ifnames=0 biosdevname=0'

# 同步cobbler
cobbler sync

# 为避免发生未知问题,先把服务端所有服务重启
systemctl restart xinetd
systemctl restart cobblerd
systemctl restart httpd
点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Jacquelyn38 Jacquelyn38
2年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Stella981 Stella981
2年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Wesley13 Wesley13
2年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
2年前
Java日期时间API系列36
  十二时辰,古代劳动人民把一昼夜划分成十二个时段,每一个时段叫一个时辰。二十四小时和十二时辰对照表:时辰时间24时制子时深夜11:00凌晨01:0023:0001:00丑时上午01:00上午03:0001:0003:00寅时上午03:00上午0
Wesley13 Wesley13
2年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
2年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
3个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这